Add full output flag to get logins command
This commit is contained in:
parent
917f875a42
commit
ac556d593e
@ -29,6 +29,7 @@ var getLoginCmd = &cobra.Command{
|
|||||||
uuid, _ := cmd.Flags().GetString("uuid")
|
uuid, _ := cmd.Flags().GetString("uuid")
|
||||||
name, _ := cmd.Flags().GetString("name")
|
name, _ := cmd.Flags().GetString("name")
|
||||||
username, _ := cmd.Flags().GetString("username")
|
username, _ := cmd.Flags().GetString("username")
|
||||||
|
fullOutput, _ := cmd.Flags().GetBool("full")
|
||||||
|
|
||||||
resp, err := commandClient.SendToAgent(ipc.GetLoginRequest{
|
resp, err := commandClient.SendToAgent(ipc.GetLoginRequest{
|
||||||
Name: name,
|
Name: name,
|
||||||
@ -44,7 +45,11 @@ var getLoginCmd = &cobra.Command{
|
|||||||
switch resp.(type) {
|
switch resp.(type) {
|
||||||
case ipc.GetLoginResponse:
|
case ipc.GetLoginResponse:
|
||||||
response := resp.(ipc.GetLoginResponse)
|
response := resp.(ipc.GetLoginResponse)
|
||||||
|
if fullOutput {
|
||||||
|
fmt.Println(response.Result)
|
||||||
|
} else {
|
||||||
fmt.Println(response.Result.Password)
|
fmt.Println(response.Result.Password)
|
||||||
|
}
|
||||||
break
|
break
|
||||||
case ipc.ActionResponse:
|
case ipc.ActionResponse:
|
||||||
println("Error: " + resp.(ipc.ActionResponse).Message)
|
println("Error: " + resp.(ipc.ActionResponse).Message)
|
||||||
@ -59,4 +64,5 @@ func init() {
|
|||||||
getLoginCmd.PersistentFlags().String("name", "", "")
|
getLoginCmd.PersistentFlags().String("name", "", "")
|
||||||
getLoginCmd.PersistentFlags().String("username", "", "")
|
getLoginCmd.PersistentFlags().String("username", "", "")
|
||||||
getLoginCmd.PersistentFlags().String("uuid", "", "")
|
getLoginCmd.PersistentFlags().String("uuid", "", "")
|
||||||
|
getLoginCmd.PersistentFlags().Bool("full", false, "")
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user