-
Notifications
You must be signed in to change notification settings - Fork 596
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add filter command add "list" subcommand (#159)
* feat: add filter command add "list" subcommand to display available filters Signed-off-by: Matthis Holleville <matthish29@gmail.com> * feat: create specific file to filterList Signed-off-by: Matthis Holleville <matthish29@gmail.com> * feat: rename ListAnalyzers to ListFilters Signed-off-by: Matthis Holleville <matthish29@gmail.com> --------- Signed-off-by: Matthis Holleville <matthish29@gmail.com>
- Loading branch information
1 parent
9f0cb62
commit 6e17c9e
Showing
5 changed files
with
62 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
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,23 @@ | ||
package filters | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var FiltersCmd = &cobra.Command{ | ||
Use: "filters", | ||
Aliases: []string{"filters"}, | ||
Short: "Manage filters for analyzing Kubernetes resources", | ||
Long: `The filters command allows you to manage filters that are used to analyze Kubernetes resources. | ||
You can list available filters to analyze resources.`, | ||
Run: func(cmd *cobra.Command, args []string) { | ||
if len(args) == 0 { | ||
cmd.Help() | ||
return | ||
} | ||
}, | ||
} | ||
|
||
func init() { | ||
FiltersCmd.AddCommand(filterListCmd) | ||
} |
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,21 @@ | ||
package filters | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/fatih/color" | ||
"github.com/k8sgpt-ai/k8sgpt/pkg/analyzer" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var filterListCmd = &cobra.Command{ | ||
Use: "list", | ||
Short: "List available filters", | ||
Long: `The list command displays a list of available filters that can be used to analyze Kubernetes resources.`, | ||
Run: func(cmd *cobra.Command, args []string) { | ||
fmt.Printf("Available filters : \n") | ||
for _, analyzer := range analyzer.ListFilters() { | ||
fmt.Printf("> %s\n", color.GreenString(analyzer)) | ||
} | ||
}, | ||
} |
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
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