Define a standard for creating commands

This commit cleans up the command constructors in an attempt to make the
codebase more uniform and approachable. This includes several refactors:

* Removed the FlagConstants - this makes the help messages and examples
  significantly more readable without needed to compile and run
  airshipctl
* Long help messages and examples are now constant
* Short, Long, and Examples all begin with a capitol letter
* Flag descriptions begin with a lowercase letter. This matches the flag
  description for the builtin "help" flag, making formatting uniform for
  all flags
* Removed redundant unit tests on non-leaf commands

This change also updates the documentation for the affected commands.

Change-Id: I8b9dcbfd9846b3deaab06dec17f80643dae78de9
This commit is contained in:
Ian Howell
2020-04-15 16:59:49 -05:00
parent e657f448ab
commit 9ffc305392
65 changed files with 835 additions and 600 deletions

View File

@@ -31,18 +31,18 @@ func TestConfigUseContext(t *testing.T) {
{
Name: "config-use-context",
CmdLine: "dummy_context",
Cmd: cmd.NewCmdConfigUseContext(settings),
Cmd: cmd.NewUseContextCommand(settings),
},
{
Name: "config-use-context-no-args",
CmdLine: "",
Cmd: cmd.NewCmdConfigUseContext(settings),
Cmd: cmd.NewUseContextCommand(settings),
Error: errors.New("accepts 1 arg(s), received 0"),
},
{
Name: "config-use-context-does-not-exist",
CmdLine: "foo",
Cmd: cmd.NewCmdConfigUseContext(settings),
Cmd: cmd.NewUseContextCommand(settings),
Error: errors.New("missing configuration: context with name 'foo'"),
},
}