The number of columns used by print-usage
and print-help
.
The number of columns used by `print-usage` and `print-help`.
The current command line option specs as a vector of maps. Only
bound within the body of with-commandline
and used by
print-usage
and print-help
.
The current command line option specs as a vector of maps. Only bound within the body of `with-commandline` and used by `print-usage` and `print-help`.
(make-parser type)
Make a new parser type
, either :basic, :gnu or :posix.
Make a new parser `type`, either :basic, :gnu or :posix.
(option {:keys [short long description type arg-name required]})
Convert an option map into an Option instance.
Convert an option map into an Option instance.
(option-map [short long description & [type arg-name required]])
Convert the command line option in vector form into a map.
Convert the command line option in vector form into a map.
(options option-maps)
Convert a seq of option maps into an Options instance.
Convert a seq of option maps into an Options instance.
Convert a command line argument
to type
.
Convert a command line `argument` to `type`.
(parse-commandline option-maps arguments & [opts])
Build a command line parser from option-maps
, parse the
arguments
and return a vector of the parsed options and any
pending arguments.
Build a command line parser from `option-maps`, parse the `arguments` and return a vector of the parsed options and any pending arguments.
(print-help syntax & {:keys [header footer pad-left pad-desc width]})
Print help about the program.
Print help about the program.
(print-usage program & {:keys [width]})
Print the usage information of the program.
Print the usage information of the program.
(string-array arguments)
Convert arguments
into an array of strings.
Convert `arguments` into an array of strings.
(with-columns size & body)
Bind *columns*
to size
and evaluate body
.
Bind `*columns*` to `size` and evaluate `body`.
(with-commandline [[options-sym arguments-sym] arguments & [parser]]
option-spec
&
body)
Evaluate body
with the parsed commandline option-spec
bound to
options-sym
and any pending command line arguments to arguments-sym
.
Example:
(with-commandline [[options arguments] ["-a" "/tmp"]] [[a all "do not hide entries starting with ."] [A almost-all "do not list implied . and .."] [b escape "print octal escapes for nongraphic characters"] [t time "the time" :time] [nil block-size "use SIZE-byte blocks" :integer "SIZE"] [B ignore-backups "do not list implied entried ending with ~"] [c nil (str "with -lt: sort by, and show, ctime (time of last modification of file status information) " "with -l: show ctime and sort by name otherwise: sort by ctime")] [C nil "list entries by columns"] [I ids "list of integers" :integers "IDS"]] (prn "Options: " options) (prn "Pending arguments: " arguments))
Evaluate `body` with the parsed commandline `option-spec` bound to `options-sym` and any pending command line arguments to `arguments-sym`. Example: (with-commandline [[options arguments] ["-a" "/tmp"]] [[a all "do not hide entries starting with ."] [A almost-all "do not list implied . and .."] [b escape "print octal escapes for nongraphic characters"] [t time "the time" :time] [nil block-size "use SIZE-byte blocks" :integer "SIZE"] [B ignore-backups "do not list implied entried ending with ~"] [c nil (str "with -lt: sort by, and show, ctime (time of last modification of file status information) " "with -l: show ctime and sort by name otherwise: sort by ctime")] [C nil "list entries by columns"] [I ids "list of integers" :integers "IDS"]] (prn "Options: " options) (prn "Pending arguments: " arguments))
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close