Liking cljdoc? Tell your friends :D

commandline.core


*columns*clj

The number of columns used by print-usage and print-help.

The number of columns used by `print-usage` and `print-help`.
sourceraw docstring

*options*clj

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`.
sourceraw docstring

make-parserclj

(make-parser type)

Make a new parser type, either :basic, :gnu or :posix.

Make a new parser `type`, either :basic, :gnu or :posix.
sourceraw docstring

optionclj

(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.
sourceraw docstring

option-mapclj

(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.
sourceraw docstring

optionsclj

(options option-maps)

Convert a seq of option maps into an Options instance.

Convert a seq of option maps into an Options instance.
sourceraw docstring

parse-argumentcljmultimethod

Convert a command line argument to type.

Convert a command line `argument` to `type`.
sourceraw docstring

parse-commandlineclj

(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.
sourceraw docstring

(print-help syntax & {:keys [header footer pad-left pad-desc width]})

Print help about the program.

Print help about the program.
sourceraw docstring

(print-usage program & {:keys [width]})

Print the usage information of the program.

Print the usage information of the program.
sourceraw docstring

string-arrayclj

(string-array arguments)

Convert arguments into an array of strings.

Convert `arguments` into an array of strings.
sourceraw docstring

with-columnscljmacro

(with-columns size & body)

Bind *columns* to size and evaluate body.

Bind `*columns*` to `size` and evaluate `body`.
sourceraw docstring

with-commandlinecljmacro

(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))
  
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close