argbash icon indicating copy to clipboard operation
argbash copied to clipboard

feature request: help and completion for TYPE_GROUP_SET

Open hemna opened this issue 5 years ago • 2 comments

I have an script that has a list of string values that are acceptable as a command.

# ARG_POSITIONAL_SINGLE([command], [The command you want to run.], [setup_everything])
# ARG_TYPE_GROUP_SET([commands], [COMMAND], [command], [add_compute,build_images,deploy_airship,deploy_osh,clean_airship,clean_airship_not_images,clean_k8s,deploy_caasp,deploy_ccp_deployer,deploy_ses,enroll_caasp_workers,patch_upstream,setup_airship,setup_caasp_workers_for_openstack,setup_everything,setup_hosts,setup_openstack,teardown,update_airship_osh], [index])

It would be nice if the help output included the list of possible values for that specific command. Currently, this is all you get...

	<command>: The command you want to run. (default: 'setup_everything')

You can't find out what the possible values are unless you give the generated script a bogus value.

Also, The bash completion doesn't support showing those list when you try tab for the command.

hemna avatar Apr 17 '19 00:04 hemna

The bash completion that is not working is a bug, it is expected to work.

The help message request is a duplicate of #76.

matejak avatar Apr 17 '19 20:04 matejak

So the completion now works only for optional arguments, positional arguments (s.a. your example) don't have the completion implemented. This is not trivial, as the completion functionality would generally have to understand what argument is being completed. This is easy for optional args (it is enough just to look at the previous word on the command-line), but it is more complicated for positional arguments - is it the first one, second one, ...?

matejak avatar May 12 '19 11:05 matejak