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

Please add support for "govc --version" and "govc --help" #3054

Closed
CarstenGrohmann opened this issue Feb 23, 2023 · 2 comments · Fixed by #3114
Closed

Please add support for "govc --version" and "govc --help" #3054

CarstenGrohmann opened this issue Feb 23, 2023 · 2 comments · Fixed by #3114

Comments

@CarstenGrohmann
Copy link
Contributor

Is your feature request related to a problem? Please describe.
Please add support for govc --help, govc -h and govc --version to govc.

Currently all three options are not available. If you call govc --help now, it prints more than 300 different options as a single list. This is very confusing.

# ./govc -h
Usage of ./govc:
  about
  about.cert
  cluster.add
  cluster.change
  cluster.create
  cluster.group.change
  cluster.group.create
  cluster.group.ls
  cluster.group.remove
[...]
  vm.rdm.attach
  vm.rdm.ls
  vm.register
  vm.unregister
  vm.upgrade
  vm.vnc
  volume.ls
  volume.rm
  vsan.change
  vsan.info

Describe the solution you'd like
govc --version is calling govc version internally:

./govc --version
govc 0.30.2

govc --help return a usage message like:

# ./govc -h
Usage: ./govc <ACTION> [COMMON OPTIONS] [PATH]...

<two lines of prosa about govc>

<add one line with license info here>

Examples:
  show toplevel structure:       govc ls
  show datacenter summary:  govc datacenter.info
  upload a VMDK file:             govc ...

Common options:
  -L=false               Follow managed object references
  -cert=                 Certificate [GOVC_CERTIFICATE]
  -dc=                   Datacenter [GOVC_DATACENTER]
  -debug=false           Store debug logs [GOVC_DEBUG]
  -dump=false            Enable Go output
  -i=false               Print the managed object reference
  -json=false            Enable JSON output
  -k=false               Skip verification of server certificate [GOVC_INSECURE]
  -key=                  Private key [GOVC_PRIVATE_KEY]
  -l=false               Long listing format
  -persist-session=true  Persist session to disk [GOVC_PERSIST_SESSION]
  -t=                    Object type
  -tls-ca-certs=         TLS CA certificates file [GOVC_TLS_CA_CERTS]
  -tls-known-hosts=      TLS known hosts file [GOVC_TLS_KNOWN_HOSTS]
  -trace=false           Write SOAP/REST traffic to stderr
  -u=                    ESX or vCenter URL [GOVC_URL]
  -verbose=false         Write request/response data to stderr
  -vim-namespace=vim25   Vim namespace [GOVC_VIM_NAMESPACE]
  -vim-version=7.0       Vim version [GOVC_VIM_VERSION]
  -xml=false             Enable XML output

For example, some commands have the option --full-help to show all details and --help shows only a short summary.

Alternatively, you could add a --list-actions option to show all available actions.

@github-actions
Copy link
Contributor

Howdy 🖐   CarstenGrohmann ! Thank you for your interest in this project. We value your feedback and will respond soon.

If you want to contribute to this project, please make yourself familiar with the CONTRIBUTION guidelines.

@dougm
Copy link
Member

dougm commented Mar 31, 2023

There is a version command:

% govc version
govc 0.30.4

Summary and examples are included in the help for each command:

% govc vm.create -h
Usage: govc vm.create [OPTIONS] NAME

Create VM.

For a list of possible '-g' IDs, use 'govc vm.option.info' or see:
https://code.vmware.com/apis/358/vsphere/doc/vim.vm.GuestOsDescriptor.GuestOsIdentifier.html

Examples:
  govc vm.create -on=false vm-name
  govc vm.create -cluster cluster1 vm-name # use compute cluster placement
  govc vm.create -datastore-cluster dscluster vm-name # use datastore cluster placement
  govc vm.create -m 2048 -c 2 -g freebsd64Guest -net.adapter vmxnet3 -disk.controller pvscsi vm-name

Options:
  -annotation=           VM description
  ...

There is also a markdown doc generated from this: https://github.com/vmware/govmomi/blob/main/govc/USAGE.md

But agree, just listing all the command names with -h is not that useful. We can certainly add more useful help, license, etc., which can be done here:

fmt.Fprintf(w, "Usage of %s:\n", os.Args[0])

priyanka19-98 pushed a commit to priyanka19-98/govmomi that referenced this issue Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants