Improved CLI's flags and changed help page (#341)

* Improved CLI's flags

Allowed users to use just --v instead of --version as a CLI flag. Also added in the --name flag that simply prints out "Browsh." An alias for the --name flag is --n.

* Changed the help page inside the config.go to include the name flag
pull/344/head
Yash Singh 2020-08-21 01:44:26 -07:00 zatwierdzone przez GitHub
rodzic 84f5382eda
commit 13dfd9288a
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
2 zmienionych plików z 12 dodań i 1 usunięć

Wyświetl plik

@ -204,10 +204,20 @@ func MainEntry() {
}
viper.SetDefault("validURL", validURL)
Initialise()
if viper.GetBool("version") {
// Print version if asked and exit
if (viper.GetBool("version") || viper.GetBool("v")) {
println(browshVersion)
os.Exit(0)
}
// Print name if asked and exit
if (viper.GetBool("name") || viper.GetBool("n")) {
println("Browsh")
os.Exit(0)
}
// Decide whether to run in http-server-mode or CLI app
if viper.GetBool("http-server-mode") {
HTTPServerStart()
} else {

Wyświetl plik

@ -24,6 +24,7 @@ var (
_ = pflag.Bool("firefox.with-gui", false, "Don't use headless Firefox")
_ = pflag.Bool("firefox.use-existing", false, "Whether Browsh should launch Firefox or not")
_ = pflag.Bool("monochrome", false, "Start browsh in monochrome mode")
_ = pflag.Bool("name", false, "Print out the name: Browsh")
)
func getConfigNamespace() string {