move list function to separate function
This commit is contained in:
parent
923c718e28
commit
4d280fc40f
1 changed files with 38 additions and 33 deletions
15
cmd/list.go
15
cmd/list.go
|
@ -4,13 +4,14 @@ Copyright © 2023 Laura Kalb <dev@lauka.net>
|
|||
package cmd
|
||||
|
||||
import (
|
||||
"codeberg.org/lauralani/ovh-apikey-manager/app"
|
||||
"fmt"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
"log"
|
||||
"os"
|
||||
"strconv"
|
||||
|
||||
"codeberg.org/lauralani/ovh-apikey-manager/app"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
// listCmd represents the list command
|
||||
|
@ -18,7 +19,12 @@ var listCmd = &cobra.Command{
|
|||
Use: "list",
|
||||
Short: "List all active API Keys",
|
||||
Long: `Lists all of your currently active API Keys`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
Run: runList,
|
||||
Args: cobra.NoArgs,
|
||||
Example: "ovh-apikey-manager delete",
|
||||
}
|
||||
|
||||
func runList(cmd *cobra.Command, args []string) {
|
||||
client := app.GetOVHClient()
|
||||
var applist []app.Application
|
||||
|
||||
|
@ -52,7 +58,6 @@ var listCmd = &cobra.Command{
|
|||
}
|
||||
fmt.Printf("%v%v: [%v] %v (%v)\n", iscurrentkey, item.ApplicationID, item.Status, item.Name, item.Description)
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
|
Loading…
Reference in a new issue