MCPcopy Index your code
hub / github.com/devopsctl/gitlabctl / runGetSSHKeyForUser

Function runGetSSHKeyForUser

cmd/get_ssh_keys.go:56–79  ·  view source on GitHub ↗
(cmd *cobra.Command)

Source from the content-addressed store, hash-verified

54}
55
56func runGetSSHKeyForUser(cmd *cobra.Command) error {
57 opts := new(gitlab.ListSSHKeysForUserOptions)
58 if cmd.Flag("page").Changed {
59 opts.Page = getFlagInt(cmd, "page")
60 }
61 if cmd.Flag("per-page").Changed {
62 opts.PerPage = getFlagInt(cmd, "per-page")
63 }
64 user := getFlagString(cmd, "user")
65 uid, err := strconv.Atoi(user)
66 if err != nil {
67 userInfo, err2 := getUserByUsername(user)
68 if err2 != nil {
69 return err2
70 }
71 uid = userInfo.ID
72 }
73 sshKeys, err := getSSHKeysForUser(uid, opts)
74 if err != nil {
75 return err
76 }
77 printSSHKeysOut(getFlagString(cmd, "out"), sshKeys...)
78 return nil
79}
80
81func runGetSSHKey(cmd *cobra.Command) error {
82 sshKeys, err := getSSHKeys()

Callers 1

get_ssh_keys.goFile · 0.85

Calls 5

getFlagIntFunction · 0.85
getFlagStringFunction · 0.85
getUserByUsernameFunction · 0.85
getSSHKeysForUserFunction · 0.85
printSSHKeysOutFunction · 0.85

Tested by

no test coverage detected