add short flags for rest of the flags and print usage when no flags are present

This commit is contained in:
Vineet K 2023-11-15 13:20:19 -05:00
parent d425358bd0
commit ba523ee94e

View File

@ -19,13 +19,13 @@ func main() {
code := getopt.StringLong("code", 'c', "", "Code to enter") code := getopt.StringLong("code", 'c', "", "Code to enter")
course := getopt.IntLong("course", 'C', -1, "Canvas course number") course := getopt.IntLong("course", 'C', -1, "Canvas course number")
list_all := getopt.BoolLong("list-all", 0, "List all courses") list_all := getopt.BoolLong("list-all", 'L', "List all courses")
list_favorites := getopt.BoolLong("list-favorites", 0, "List favorite courses") list_favorites := getopt.BoolLong("list-favorites", 'F', "List favorite courses")
help := getopt.BoolLong("help", 0, "Help") help := getopt.BoolLong("help", 'h', "Help")
getopt.Parse() getopt.Parse()
if *help { if *help || (*list_all == false && *list_favorites == false && *code == "" && *course == -1) {
getopt.Usage() getopt.Usage()
os.Exit(0) os.Exit(0)
} }