feat: handle -h option

pull/61/head
sammyette 2021-06-12 10:48:57 -04:00
parent b974ada64e
commit e6c4c32bd7
No known key found for this signature in database
GPG Key ID: 50EE40A2809851F5
1 changed files with 6 additions and 0 deletions

View File

@ -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
}