Add copy to clipboard flag for ssh key creation
This commit is contained in:
parent
4f3939878c
commit
c2e5801769
|
@ -6,6 +6,7 @@ package cmd
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/atotto/clipboard"
|
||||||
"github.com/quexten/goldwarden/client"
|
"github.com/quexten/goldwarden/client"
|
||||||
"github.com/quexten/goldwarden/ipc"
|
"github.com/quexten/goldwarden/ipc"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
@ -42,6 +43,8 @@ var sshAddCmd = &cobra.Command{
|
||||||
case ipc.CreateSSHKeyResponse:
|
case ipc.CreateSSHKeyResponse:
|
||||||
response := result.(ipc.CreateSSHKeyResponse)
|
response := result.(ipc.CreateSSHKeyResponse)
|
||||||
fmt.Println(response.Digest)
|
fmt.Println(response.Digest)
|
||||||
|
clipboard.WriteAll(string(response.Digest))
|
||||||
|
break
|
||||||
case ipc.ActionResponse:
|
case ipc.ActionResponse:
|
||||||
println("Error: " + result.(ipc.ActionResponse).Message)
|
println("Error: " + result.(ipc.ActionResponse).Message)
|
||||||
return
|
return
|
||||||
|
@ -80,5 +83,6 @@ func init() {
|
||||||
sshCmd.AddCommand(sshAddCmd)
|
sshCmd.AddCommand(sshAddCmd)
|
||||||
sshAddCmd.PersistentFlags().String("name", "", "")
|
sshAddCmd.PersistentFlags().String("name", "", "")
|
||||||
sshAddCmd.MarkFlagRequired("name")
|
sshAddCmd.MarkFlagRequired("name")
|
||||||
|
sshAddCmd.PersistentFlags().Bool("--clipboard", false, "Copy the public key to the clipboard")
|
||||||
sshCmd.AddCommand(listSSHCmd)
|
sshCmd.AddCommand(listSSHCmd)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue