commit ba523ee94e44fe2ce9e4eee90ffd63eda5a705ae
parent d425358bd0ac54bf9bfe176d5328b2d87fa86f27
Author: vin <git@vineetk.net>
Date: Wed, 15 Nov 2023 13:20:19 -0500
add short flags for rest of the flags and print usage when no flags are present
Diffstat:
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/main.go b/main.go
@@ -19,13 +19,13 @@ func main() {
code := getopt.StringLong("code", 'c', "", "Code to enter")
course := getopt.IntLong("course", 'C', -1, "Canvas course number")
- list_all := getopt.BoolLong("list-all", 0, "List all courses")
- list_favorites := getopt.BoolLong("list-favorites", 0, "List favorite courses")
- help := getopt.BoolLong("help", 0, "Help")
+ list_all := getopt.BoolLong("list-all", 'L', "List all courses")
+ list_favorites := getopt.BoolLong("list-favorites", 'F', "List favorite courses")
+ help := getopt.BoolLong("help", 'h', "Help")
getopt.Parse()
- if *help {
+ if *help || (*list_all == false && *list_favorites == false && *code == "" && *course == -1) {
getopt.Usage()
os.Exit(0)
}