Skip to content

Commit

Permalink
Improved CLI's flags and changed help page (#341)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Yash-Singh1 committed Aug 21, 2020
1 parent 84f5382 commit 13dfd92
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
12 changes: 11 additions & 1 deletion interfacer/src/browsh/browsh.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions interfacer/src/browsh/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 13dfd92

Please sign in to comment.