Skip to content

Conversation

@sgsullivan
Copy link
Contributor

Introduces the concept of default flags from (#23).

ssullivan@data ~/golang/src/github.com/liquidweb/liquidweb-cli $ lw help default-flags 
No default value for flag [template] set. See 'help default-flags set' for details.
TIP: You can silence undefined default flag notices with 'default-flags nags-off'
Manage the configured default flags.

If a default flag is set (such as for "zone") then any subcommand will use its
value in place if omitted. Default flags are auth context aware. For details
on auth contexts, see 'help auth'.

For a full list of capabilities, please refer to the "Available Commands" section.

Usage:
  lw default-flags [flags]
  lw default-flags [command]

Available Commands:
  delete      Delete a flag
  get         Get details on a flag
  list        Display your set default flags
  nags-off    Turn nags off
  nags-on     Turn nags on
  permitted   Display permitted default flags
  set         Set a flag

Flags:
  -h, --help   help for default-flags

Global Flags:
      --config string        config file (default is $HOME/.liquidweb-cli.yaml)
      --use-context string   forces current context, without persisting the context change

Use "lw default-flags [command] --help" for more information about a command.
ssullivan@data ~/golang/src/github.com/liquidweb/liquidweb-cli $ 

To start out, I've added support for zone and template flag default values.. and wired them in where appropriate. Following this system, we can now easily add any future default flags we wish.

@sgsullivan
Copy link
Contributor Author

sgsullivan commented Jan 4, 2021

added support for config-id 42ae480 (thanks for that idea @jvandellen). This is the basic usage:

lw default-flags set --flag zone --value 27 --use-context production
lw default-flags set --flag template --value DEBIAN_10_UNMANAGED --use-context production
lw default-flags set --flag config-id --value 1090 --use-context production
ssullivan@data2 ~ $ lw default-flags list --use-context production
Configured default flags:

  Flag: config-id
    Value: 1090
  Flag: template
    Value: DEBIAN_10_UNMANAGED
  Flag: zone
    Value: 27
ssullivan@data2 ~ $ 

with these set, you can create a cloud server without any args at all..

ssullivan@data2 ~ $ lw cloud server create
Cloud server with uniq-id [ABC123] creating. Check status with 'cloud server status --uniq-id ABC123'
ssullivan@data2 ~ $

Copy link
Contributor

@jvandellen jvandellen left a comment

Choose a reason for hiding this comment

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

👍

@sgsullivan sgsullivan requested a review from dwburke January 13, 2021 04:25
@sgsullivan sgsullivan merged commit 473ed8c into master Jan 14, 2021
@sgsullivan sgsullivan deleted the default-flags branch January 14, 2021 15:39
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.

add ability to save default flag values on a global basis

4 participants