make height a persistent flag

make a viper binding for it

env var prefix now IGNR_
This commit is contained in:
2025-06-17 20:53:49 +01:00
parent 4b756ee2fd
commit 39f762c0e6
4 changed files with 17 additions and 20 deletions

View File

@@ -54,11 +54,14 @@ You may also list available templates and generate .gitignore files based on tho
// init initialises the root command and its flags.
func init() {
rootCmd.PersistentFlags().StringP("token", "t", "", "GitHub authentication token")
rootCmd.PersistentFlags().IntP("height", "H", 20, "Height of the selection prompt")
rootCmd.Flags().BoolP("version", "v", false, "Print the version of the CLI")
viper.SetEnvPrefix("GH")
viper.SetEnvPrefix("IGNR")
viper.AutomaticEnv()
viper.BindPFlag("token", rootCmd.PersistentFlags().Lookup("token"))
viper.BindPFlag("height", rootCmd.PersistentFlags().Lookup("height"))
}
// main is the entry point of the application.