✨ Add -p flag to config
This commit is contained in:
parent
396f19f691
commit
bddf8e1458
1 changed files with 6 additions and 0 deletions
|
|
@ -32,6 +32,11 @@ var configCmd = &cobra.Command{
|
||||||
//Long: ``,
|
//Long: ``,
|
||||||
SilenceUsage: true,
|
SilenceUsage: true,
|
||||||
RunE: func(cmd *cobra.Command, args []string) (err error) {
|
RunE: func(cmd *cobra.Command, args []string) (err error) {
|
||||||
|
print, _ := cmd.Flags().GetBool("print")
|
||||||
|
if print {
|
||||||
|
fmt.Fprintln(cmd.OutOrStdout(), config.ConfigPath)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
force, _ := cmd.Flags().GetBool("force")
|
force, _ := cmd.Flags().GetBool("force")
|
||||||
if !force {
|
if !force {
|
||||||
_, err = os.Stat(config.ConfigPath)
|
_, err = os.Stat(config.ConfigPath)
|
||||||
|
|
@ -60,4 +65,5 @@ func init() {
|
||||||
rootCmd.AddCommand(configCmd)
|
rootCmd.AddCommand(configCmd)
|
||||||
|
|
||||||
configCmd.Flags().BoolP("force", "f", false, "Force overwrite")
|
configCmd.Flags().BoolP("force", "f", false, "Force overwrite")
|
||||||
|
configCmd.Flags().BoolP("print", "p", false, "Print path only")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue