ionos-cloud / ionosctl

The IONOS Cloud CLI (ionosctl) gives the ability to manage IONOS Cloud infrastructure directly from Command Line.
Apache License 2.0
28 stars 6 forks source link

enhancement: restructure help template #423

Closed avirtopeanu-ionos closed 6 months ago

avirtopeanu-ionos commented 6 months ago

Reorders the Help Template such that current command related functionalities are printed last, similar to how kubectl does it. Basically in CLIs the read order is bottom-to-top, so this new order should reflect that.

This should get rid of the "ping-pong" style scrolling that users have to do to find information for that command (i.e. scrolling up to examples, down to flags, up to usage, etc.). This was also most noticeable in commands with available subcommands, where users commonly had to scroll up to see these subcommands.

Also, now a developer can just re-order the templates more easily, they don't depend on each other for newlines, indents, trims, etc. and manage the whitespaces around them by themself, as well as the if-conditions are reworked to be included in that specific section.

ionosctl datacenter before:

The sub-commands of `ionosctl datacenter` allow you to create, list, get, update and delete Data Centers.

USAGE: 
  ionosctl datacenter [command]

ALIASES:
  datacenter, d, dc, vdc

AVAILABLE COMMANDS:
  create      Create a Data Center
  delete      Delete a Data Center
  get         Get a Data Center
  list        List Data Centers
  update      Update a Data Center

FLAGS:
      --cols strings   Set of columns to be printed on output 
                       Available columns: [DatacenterId Name Location State Description Version Features CpuFamily SecAuthProtection IPv6CidrBlock] (default [DatacenterId,Name,Location,CpuFamily,IPv6CidrBlock,State])

GLOBAL FLAGS:
  -u, --api-url string   Override default host url (default "https://api.ionos.com")
  -c, --config string    Configuration file used for authentication (default "/home/avirtopeanu/.config/ionosctl/config.json")
  -f, --force            Force command to execute without user input
  -h, --help             Print usage
      --no-headers       Don't print table headers when table output is used
  -o, --output string    Desired output format [text|json|api-json] (default "text")
  -q, --quiet            Quiet output
  -v, --verbose          Print step-by-step process when running command

Use "ionosctl datacenter [command] --help" for more information about a command.

ionosctl datacenter after:

The sub-commands of `ionosctl datacenter` allow you to create, list, get, update and delete Data Centers.

GLOBAL FLAGS:
  -u, --api-url string   Override default host url (default "https://api.ionos.com")
  -c, --config string    Configuration file used for authentication (default "/home/avirtopeanu/.config/ionosctl/config.json")
  -f, --force            Force command to execute without user input
  -h, --help             Print usage
      --no-headers       Don't print table headers when table output is used
  -o, --output string    Desired output format [text|json|api-json] (default "text")
  -q, --quiet            Quiet output
  -v, --verbose          Print step-by-step process when running command

FLAGS:
      --cols strings   Set of columns to be printed on output 
                       Available columns: [DatacenterId Name Location State Description Version Features CpuFamily SecAuthProtection IPv6CidrBlock] (default [DatacenterId,Name,Location,CpuFamily,IPv6CidrBlock,State])

ALIASES:
  datacenter, d, dc, vdc

AVAILABLE COMMANDS:
  create      Create a Data Center
  delete      Delete a Data Center
  get         Get a Data Center
  list        List Data Centers
  update      Update a Data Center

Use "ionosctl datacenter [command] --help" for more information about a command.

ionosctl datacenter create --help before:

 % i dc create --help 
Use this command to create a Virtual Data Center. You can specify the name, description or location for the object.

Virtual Data Centers are the foundation of the IONOS platform. VDCs act as logical containers for all other objects you will be creating, e.g. servers. You can provision as many Data Centers as you want. Data Centers have their own private network and are logically segmented from each other to create isolation.

You can wait for the Request to be executed using `--wait-for-request` option.

USAGE: 
  ionosctl datacenter create [flags]

ALIASES:
  create, c

EXAMPLES:
ionosctl datacenter create --name NAME --location LOCATION_ID
ionosctl datacenter create --name NAME --location LOCATION_ID --wait-for-request

FLAGS:
  -D, --depth int32          Controls the detail depth of the response objects. Max depth is 10.
  -d, --description string   Description of the Data Center
  -l, --location string      Location for the Data Center (default "de/txl")
  -n, --name string          Name of the Data Center (default "Unnamed Data Center")
  -t, --timeout int          Timeout option for Request for Data Center creation [seconds] (default 60)
  -w, --wait-for-request     Wait for the Request for Data Center creation to be executed

GLOBAL FLAGS:
  -u, --api-url string   Override default host url (default "https://api.ionos.com")
      --cols strings     Set of columns to be printed on output 
                         Available columns: [DatacenterId Name Location State Description Version Features CpuFamily SecAuthProtection IPv6CidrBlock] (default [DatacenterId,Name,Location,CpuFamily,IPv6CidrBlock,State])
  -c, --config string    Configuration file used for authentication (default "/home/avirtopeanu/.config/ionosctl/config.json")
  -f, --force            Force command to execute without user input
  -h, --help             Print usage
      --no-headers       Don't print table headers when table output is used
  -o, --output string    Desired output format [text|json|api-json] (default "text")
  -q, --quiet            Quiet output
  -v, --verbose          Print step-by-step process when running command

ionosctl datacenter create --help after:

 % i dc create --help
Use this command to create a Virtual Data Center. You can specify the name, description or location for the object.

Virtual Data Centers are the foundation of the IONOS platform. VDCs act as logical containers for all other objects you will be creating, e.g. servers. You can provision as many Data Centers as you want. Data Centers have their own private network and are logically segmented from each other to create isolation.

You can wait for the Request to be executed using `--wait-for-request` option.

GLOBAL FLAGS:
  -u, --api-url string   Override default host url (default "https://api.ionos.com")
      --cols strings     Set of columns to be printed on output 
                         Available columns: [DatacenterId Name Location State Description Version Features CpuFamily SecAuthProtection IPv6CidrBlock] (default [DatacenterId,Name,Location,CpuFamily,IPv6CidrBlock,State])
  -c, --config string    Configuration file used for authentication (default "/home/avirtopeanu/.config/ionosctl/config.json")
  -f, --force            Force command to execute without user input
  -h, --help             Print usage
      --no-headers       Don't print table headers when table output is used
  -o, --output string    Desired output format [text|json|api-json] (default "text")
  -q, --quiet            Quiet output
  -v, --verbose          Print step-by-step process when running command

FLAGS:
  -D, --depth int32          Controls the detail depth of the response objects. Max depth is 10.
  -d, --description string   Description of the Data Center
  -l, --location string      Location for the Data Center (default "de/txl")
  -n, --name string          Name of the Data Center (default "Unnamed Data Center")
  -t, --timeout int          Timeout option for Request for Data Center creation [seconds] (default 60)
  -w, --wait-for-request     Wait for the Request for Data Center creation to be executed

ALIASES:
  create, c

EXAMPLES:
ionosctl datacenter create --name NAME --location LOCATION_ID
ionosctl datacenter create --name NAME --location LOCATION_ID --wait-for-request

USAGE:
  ionosctl datacenter create [flags]
sonarcloud[bot] commented 6 months ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud