Skip to content

Add kubectl-neat version command#67

Merged
itaysk merged 2 commits into
itaysk:masterfrom
amirschw:version
Jun 5, 2021
Merged

Add kubectl-neat version command#67
itaysk merged 2 commits into
itaysk:masterfrom
amirschw:version

Conversation

@amirschw

@amirschw amirschw commented Jun 4, 2021

Copy link
Copy Markdown
Contributor

Add "version" command to kubectl-neat.

Closes #63

~ $ kubectl-neat version
kubectl-neat version: v2.0.3-next

~ $ kubectl-neat version --help
Print the version of kubectl-neat

Usage:
  kubectl-neat version [flags]

Flags:
  -h, --help   help for version

Global Flags:
  -o, --output string   output format: yaml or json (default "yaml")

~ $ kubectl-neat --help
Usage:
  kubectl-neat [flags]
  kubectl-neat [command]

Examples:
kubectl get pod mypod -o yaml | kubectl neat
kubectl get pod mypod -oyaml | kubectl neat -o json
kubectl neat -f - <./my-pod.json
kubectl neat -f ./my-pod.json
kubectl neat -f ./my-pod.json --output yaml

Available Commands:
  get         
  help        Help about any command
  version     Print kubectl-neat version

Flags:
  -f, --file string     file path to neat, or - to read from stdin (default "-")
  -h, --help            help for kubectl-neat
  -o, --output string   output format: yaml or json (default "yaml")

Use "kubectl-neat [command] --help" for more information about a command.

Comment thread cmd/cmd.go
Short: "Print kubectl-neat version",
Long: "Print the version of kubectl-neat",
Run: func(cmd *cobra.Command, args []string) {
fmt.Printf("kubectl-neat version: %s\n", Version)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @itaysk, hope you're well :)

I started off with this basic implementation that only prints the version. Let me know if you would like to expand it by displaying other information like git commit or build date, and then perhaps also introduce a --short flag.

Also note that I am currently ignoring the persistent --output flag, as I couldn't find a good way to disable a global flag from a specific command. The version can of course be printed as JSON or YAML if you don't find it an overkill.

@itaysk

itaysk commented Jun 4, 2021

Copy link
Copy Markdown
Owner

Thanks @amirschw ! Nice to hear from you.
Looks good to me. My only comment is to maybe add the Version variable to the existing cmd.go file instead of creating a new file just for one variable. WDYT?

@amirschw

amirschw commented Jun 4, 2021

Copy link
Copy Markdown
Contributor Author

You too @itaysk! and thanks for kubectl-neat, we find it very useful here.
As for the comment - absolutely, I moved the variable to the cmd.go file. Should I squash the commits?

@itaysk

itaysk commented Jun 5, 2021

Copy link
Copy Markdown
Owner

Should I squash the commits?

I can do that as part of the merge

@itaysk itaysk merged commit f975c89 into itaysk:master Jun 5, 2021
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

Successfully merging this pull request may close these issues.

Suggestion: Add version flag

2 participants