Implement showing of the help text also when sdlcli tool is called
without any arguments.
Issue-Id: RIC-113
Signed-off-by: Timo Tietavainen <timo.tietavainen@nokia.com>
Change-Id: I6ebd9844fe09debeeb24946ba55ebfb2d7b807c3
Short: "Shared Data Layer (SDL) troubleshooting command line tool",
Long: `Shared Data Layer (SDL) troubleshooting command line tool`,
Run: func(cmd *cobra.Command, args []string) {
Short: "Shared Data Layer (SDL) troubleshooting command line tool",
Long: `Shared Data Layer (SDL) troubleshooting command line tool`,
Run: func(cmd *cobra.Command, args []string) {
expErr error
expOutput string
}{
expErr error
expOutput string
}{
+ {args: "", expErr: expOkErr, expOutput: expHelp},
{args: "-h", expErr: expOkErr, expOutput: expHelp},
{args: "--help", expErr: expOkErr, expOutput: expHelp},
{args: "--some-unknown-flag", expErr: expNokErr, expOutput: expHelp},
{args: "-h", expErr: expOkErr, expOutput: expHelp},
{args: "--help", expErr: expOkErr, expOutput: expHelp},
{args: "--some-unknown-flag", expErr: expNokErr, expOutput: expHelp},
cmd.SetOut(buf)
cmd.SetErr(buf)
cmd.SetArgs([]string{test.args})
cmd.SetOut(buf)
cmd.SetErr(buf)
cmd.SetArgs([]string{test.args})
err := cmd.Execute()
result := buf.String()
assert.Equal(t, test.expErr, err)
err := cmd.Execute()
result := buf.String()
assert.Equal(t, test.expErr, err)