linode-cli icon indicating copy to clipboard operation
linode-cli copied to clipboard

[Feature]: sort command-line options in help output

Open jschauma opened this issue 1 year ago • 1 comments

Description

When running -h to view available options, it would be useful if the options were sorted alphabetically. That makes it a lot easier to find an option one is looking for.

Potential Usage Example

$ linode-cli linodes create -h
[...]
options:
  -h, --help            show this help message and exit
  --authorized_keys authorized_keys
  --authorized_users authorized_users
  --backup_id backup_id
  --backups_enabled backups_enabled
  --booted booted
  --firewall_id firewall_id
  --group group
  --image image
  --interfaces interfaces
  --interfaces.active active
  --interfaces.ip_ranges ip_ranges
  --interfaces.ipam_address ipam_address
  --interfaces.ipv4.nat_1_1 nat_1_1
  --interfaces.ipv4.vpc vpc
  --interfaces.label label
  --interfaces.primary primary
  --interfaces.purpose purpose
  --interfaces.subnet_id subnet_id
  --label label
  --metadata.user_data user_data
  --private_ip private_ip
  --region region
  --root_pass [ROOT_PASS]
  --stackscript_data stackscript_data
  --stackscript_id stackscript_id
  --swap_size swap_size
  --tags tags
  --type type
$

(Likewise for all other cli tools.)

jschauma avatar Sep 28 '24 17:09 jschauma

Note that enhanced version of help for the commands can be printed like this:

linodecli --help linodes create

Despite of this, here is a proposed solution that sorts options also in your invocation: https://github.com/linode/linode-cli/pull/708

Example:

$ linode-cli linodes create -h
[...]
Create a Linode.

optional arguments:
  --authorized_keys authorized_keys
  --authorized_users authorized_users
  --backup_id backup_id
  --backups_enabled backups_enabled
  --booted booted
  --disk_encryption disk_encryption
  --firewall_id firewall_id
  --group group
  --image image
  --interfaces interfaces
  --interfaces.ip_ranges ip_ranges
  --interfaces.ipam_address ipam_address
  --interfaces.ipv4.nat_1_1 nat_1_1
  --interfaces.ipv4.vpc vpc
  --interfaces.label label
  --interfaces.primary primary
  --interfaces.purpose purpose
  --interfaces.subnet_id subnet_id
  --label label
  --metadata.user_data user_data
  --placement_group.id id
  --private_ip private_ip
  --region region
  --root_pass [ROOT_PASS]
  --stackscript_data stackscript_data
  --stackscript_id stackscript_id
  --swap_size swap_size
  --tags tags
  --type type
  -h, --help            show this help message and exit

gergelyk avatar Dec 30 '24 09:12 gergelyk