-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cmd): Add new 'list' command to list installed plugins
- Loading branch information
1 parent
9a460d1
commit baca59c
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package main | ||
|
||
import ( | ||
"context" | ||
"errors" | ||
"strconv" | ||
"strings" | ||
|
||
"github.com/spf13/cobra" | ||
) | ||
|
||
var listCmd = &cobra.Command{ | ||
Use: "list", | ||
Aliases: []string{"ls", "l", "installed"}, | ||
Short: "List installed plugins", | ||
Long: "List installed plugins by name, author, tags or summary", | ||
Example: `flower list`, | ||
Args: cobra.NoArgs, | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
var sb strings.Builder | ||
|
||
// quote-parse using strconv | ||
for i, arg := range args { | ||
sb.WriteString(strconv.Quote(arg)) | ||
if i < len(args)-1 { | ||
sb.WriteString(" ") | ||
} | ||
} | ||
|
||
return listPlugins(cmd.Context(), sb.String()) | ||
}, | ||
} | ||
|
||
func init() { | ||
rootCmd.AddCommand(listCmd) | ||
} | ||
|
||
func listPlugins(ctx context.Context, query string) error { | ||
return errors.New("not implemented") | ||
} |