l3nz / cli-matic

Compact, hands-free [sub]command line parsing library for Clojure.
Eclipse Public License 2.0
361 stars 29 forks source link

Support nil options on sub-command #65

Closed skovuri41 closed 5 years ago

skovuri41 commented 5 years ago

issue #24 is not working in current release, ability to use empty :opts [].

l3nz commented 5 years ago

It works for me: https://github.com/l3nz/cli-matic/blob/master/examples/noparms.clj

skovuri41 commented 5 years ago

It does not work if I have zero argument function, in your example the function 'say_hi' takes argument 'parms' and does not do anything with it. If I make it as function that takes no argument it fails with the exception:

clojure.lang.ArityException
   :message Wrong number of args (1) passed to:
(defn say_hi
  "Just say hi"
  [parms]
  (println "Hi man!"))
l3nz commented 5 years ago

This is by design; all functions called will receive a map with parsed arguments and any leftovers. All of them expect a one-arity call.