commander.el is a command
line parser for Emacs. It avoids messing with command-switch-alist
(and friends) and instead defines the schema in an elegant API.
Here is a (silly) example where numbers can be added and subtracted.
(require 'commander)
(defvar calc-fn nil)
(defun calc (&rest args)
  (if calc-fn
      (message "%s" (apply calc-fn (mapcar 'string-to-int args)))
    0))
(defun add ()
  (setq calc-fn '+))
(defun sub ()
  (setq calc-fn '-))
(commander
 (option "--help, -h" "Show usage information" commander-print-usage)
 (option "--add" "Add values" add)
 (option "--sub" "Subtract values" sub)
 (command "calc [*]" "Calculate these values" calc))Add list of values
$ carton exec emacs --script math.el -- calc 1 2 3 4 5 --add
15Subtract list of values
$ carton exec emacs --script math.el -- calc 1 2 3 4 5 --sub
-13Show usage information
$ carton exec emacs --script math.el -- --help
USAGE: math.el COMMAND [OPTIONS]
COMMANDS:
 calc <*>            Calculate these values
OPTIONS:
 --sub               Subtract values
 --add               Add values
 -h                  Show usage information
 --help              Show usage informationMore information is available at Github: https://github.com/rejeep/commander.el