Explorar el Código

make "help" the default option, catch non-options

George C. Privon hace 6 años
padre
commit
3bc9b98e81
Se han modificado 1 ficheros con 3 adiciones y 2 borrados
  1. 3 2
      update_proposals.rkt

+ 3 - 2
update_proposals.rkt

@@ -17,7 +17,7 @@
 ; set up command line arguments
 (define mode (command-line
               #:program "update_proposals"
-              #:args (updatetype) ; (add, update)
+              #:args ([updatetype "help"]) ; (add, update, help)
               updatetype))
 
 ; print some help
@@ -118,7 +118,8 @@
 (cond
   [(regexp-match "help" mode) (printhelp)]
   [(regexp-match "add" mode) (addnew)]
-  [(regexp-match "update" mode) (findpending)])
+  [(regexp-match "update" mode) (findpending)]
+  [else (error(string-append "Unknown mode. Try " progname " help\n\n"))])
 
 ; close the databse
 (disconnect conn)