mirror of
https://github.com/kubevela/kubevela.git
synced 2026-08-18 03:56:36 +00:00
Clean up code duplicate
This commit is contained in:
@@ -73,7 +73,7 @@ func NewCapCenterConfigCommand(ioStreams cmdutil.IOStreams) *cobra.Command {
|
||||
return nil
|
||||
},
|
||||
}
|
||||
cmd.PersistentFlags().StringP("token", "t", "", "Github Repo token")
|
||||
AddTokenVarFlags(cmd)
|
||||
return cmd
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ func NewCapInstallCommand(c types.Args, ioStreams cmdutil.IOStreams) *cobra.Comm
|
||||
return nil
|
||||
},
|
||||
}
|
||||
cmd.PersistentFlags().StringP("token", "t", "", "Github Repo token")
|
||||
AddTokenVarFlags(cmd)
|
||||
return cmd
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ func NewCapUninstallCommand(c types.Args, ioStreams cmdutil.IOStreams) *cobra.Co
|
||||
return common.RemoveCapability(env.Namespace, c, newClient, name, ioStreams)
|
||||
},
|
||||
}
|
||||
cmd.PersistentFlags().StringP("token", "t", "", "Github Repo token")
|
||||
AddTokenVarFlags(cmd)
|
||||
return cmd
|
||||
}
|
||||
|
||||
|
||||
@@ -47,3 +47,8 @@ func PrintHelpByTag(cmd *cobra.Command, all []*cobra.Command, tag string) {
|
||||
cmd.Println(table.String())
|
||||
cmd.Println()
|
||||
}
|
||||
|
||||
// AddTokenVarFlags adds token flag to a command
|
||||
func AddTokenVarFlags(cmd *cobra.Command) {
|
||||
cmd.PersistentFlags().StringP("token", "t", "", "Github Repo token")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user