Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd: default value of the inputFile flag #46

Open
iamyeka opened this issue Sep 28, 2020 · 2 comments
Open

cmd: default value of the inputFile flag #46

iamyeka opened this issue Sep 28, 2020 · 2 comments

Comments

@iamyeka
Copy link

iamyeka commented Sep 28, 2020

inputFile = rootCmd.Flags().StringP("file", "f", "-", "file path to neat, or - to read from stdin")

kubectl-neat/cmd/cmd.go

Lines 60 to 68 in 78c0fa2

if *inputFile == "-" {
stdin := cmd.InOrStdin()
in, err = ioutil.ReadAll(stdin)
} else {
in, err = ioutil.ReadFile(*inputFile)
if err != nil {
return err
}
}

In daily work, when we need to know how to use a command tool(for example: kubectl), we simply execute kubectl -h or just kubectl, then the help information will be shown on the screen. However, kubectl-neat cannot be executed like that which is a little confusing if someone uses the tool directly without reading README.md carefully.

@itaysk
Copy link
Owner

itaysk commented Sep 29, 2020

Hi @w0nwig thanks for taking the time to open this issue. kubectl-neat should print help info when the -h or --help flags are used. did that not work for you?

@iamyeka
Copy link
Author

iamyeka commented Sep 30, 2020

I mean when i simply execute kubectl-neat (without -h or --help), there's no output cause the program is waiting for stdin which is a little weird if i don't know The Default Value Of InputFile Is '-'. When i use other tools like kubectl and type kubectl on the console, my purpose is to see the help info of this tool.

The output will be like below when i type kubectl:

MacBook-Pro-WRJ:~ wrj$ kubectl
kubectl controls the Kubernetes cluster manager.

 Find more information at: https://kubernetes.io/docs/reference/kubectl/overview/

Basic Commands (Beginner):
  create         Create a resource from a file or from stdin.
  expose         使用 replication controller, service, deployment 或者 pod 并暴露它作为一个 新的
Kubernetes Service
  run            在集群中运行一个指定的镜像
  set            为 objects 设置一个指定的特征

Basic Commands (Intermediate):
  explain        查看资源的文档
  get            显示一个或更多 resources
  edit           在服务器上编辑一个资源
  delete         Delete resources by filenames, stdin, resources and names, or by resources and label selector

Deploy Commands:
  rollout        Manage the rollout of a resource
  scale          为 Deployment, ReplicaSet, Replication Controller 或者 Job 设置一个新的副本数量
  autoscale      自动调整一个 Deployment, ReplicaSet, 或者 ReplicationController 的副本数量

Cluster Management Commands:
  certificate    修改 certificate 资源.
  cluster-info   显示集群信息
  top            Display Resource (CPU/Memory/Storage) usage.
  cordon         标记 node 为 unschedulable
  uncordon       标记 node 为 schedulable
  drain          Drain node in preparation for maintenance
  taint          更新一个或者多个 node 上的 taints

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants