From 579d5c667db907987eea078ec368237626c0158b Mon Sep 17 00:00:00 2001 From: mosesyou Date: Wed, 19 Aug 2020 15:48:23 +0800 Subject: [PATCH] add flag `--app` for `app:ls` --- pkg/cmd/ls.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/cmd/ls.go b/pkg/cmd/ls.go index 2785e5a3e..9a7f29291 100644 --- a/pkg/cmd/ls.go +++ b/pkg/cmd/ls.go @@ -13,6 +13,8 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" ) +var appName string + func NewAppsCommand(c types.Args, ioStreams cmdutil.IOStreams) *cobra.Command { ctx := context.Background() cmd := &cobra.Command{ @@ -31,7 +33,7 @@ func NewAppsCommand(c types.Args, ioStreams cmdutil.IOStreams) *cobra.Command { if err != nil { return err } - printApplicationList(ctx, newClient, "", env.Namespace) + printApplicationList(ctx, newClient, appName, env.Namespace) return nil }, Annotations: map[string]string{ @@ -39,7 +41,7 @@ func NewAppsCommand(c types.Args, ioStreams cmdutil.IOStreams) *cobra.Command { }, } - cmd.PersistentFlags().StringP("app", "a", "", "Application name") + cmd.PersistentFlags().StringVarP(&appName, "app", "a", "", "Application name") return cmd }