summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYash Singh <53054099+Yash-Singh1@users.noreply.github.com>2020-08-21 01:44:26 -0700
committerGitHub <noreply@github.com>2020-08-21 10:44:26 +0200
commit13dfd9288a5e548582d7f54112aa1ee6531fe891 (patch)
treeec64822e79285ead17e388be2aa9684ed756a3f4
parent84f5382eda69e206c49bfaa777b3c1445f3a3a96 (diff)
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
-rw-r--r--interfacer/src/browsh/browsh.go12
-rw-r--r--interfacer/src/browsh/config.go1
2 files changed, 12 insertions, 1 deletions
diff --git a/interfacer/src/browsh/browsh.go b/interfacer/src/browsh/browsh.go
index d3f2dc5..f6f2486 100644
--- a/interfacer/src/browsh/browsh.go
+++ b/interfacer/src/browsh/browsh.go
@@ -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 {
diff --git a/interfacer/src/browsh/config.go b/interfacer/src/browsh/config.go
index 81f56eb..7a108bd 100644
--- a/interfacer/src/browsh/config.go
+++ b/interfacer/src/browsh/config.go
@@ -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 {