From e6c4c32bd7dc2e27ff3a6eb07dda104532474ed7 Mon Sep 17 00:00:00 2001 From: sammyette <38820196+TorchedSammy@users.noreply.github.com> Date: Sat, 12 Jun 2021 10:48:57 -0400 Subject: [PATCH] feat: handle -h option --- main.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/main.go b/main.go index 4850b4d..dd1656d 100644 --- a/main.go +++ b/main.go @@ -44,6 +44,7 @@ func main() { defaultConfPath = filepath.Join(strings.Replace(defaultConfDir, "~", homedir, 1), ".hilbishrc.lua") } + helpflag := getopt.BoolLong("help", 'h', "Prints Hilbish flags") verflag := getopt.BoolLong("version", 'v', "Prints Hilbish version") setshflag := getopt.BoolLong("setshellenv", 'S', "Sets $SHELL to Hilbish's executed path") cmdflag := getopt.StringLong("command", 'c', "", "Executes a command on startup") @@ -57,6 +58,11 @@ func main() { interactiveflag := getopt.Lookup('i').Seen() noexecflag := getopt.Lookup('n').Seen() + if *helpflag { + getopt.PrintUsage(os.Stdout) + os.Exit(0) + } + if *cmdflag == "" || interactiveflag { interactive = true }