defmain
defmain copied to clipboard
Scoping of subcommands
(defmain (foo create) ...)
(defmain (bar create) ...)
It's not clear from the documentation, but the two will interfere even if they're different subcommands. Should one use symbols in different packages? E.g.
(defmain (foo my-cli-foo:create) ...)
(defmain (bar my-cli-bar:create) ...)
Or is there some way of decoupling the name of a subcommand from the word used to invoke it, e.g.,
(defmain (foo (create-foo "create")) ...)
(defmain (bar (create-bar "create")) ...)
In any case, the documentation ought to say something about this.
Yeah, defmain and defcommand create a usual functions and using the same name will cause name conflict.
If you want, you can modify DEFCOMMAND macro and to introduce a COMMAND-NAME keyword argument, as I did for DEFMAIN's macro argument PROGRAM-NAME: https://40ants.com/defmain/#x-28DEFMAIN-3ADEFMAIN-20-2840ANTS-DOC-2FLOCATIVES-3AMACRO-29-29
Usually I'm using package inferred asdf systems and in this case each command will be defined in it's own file and have it's own package.
If you want, you can modify
DEFCOMMANDmacro and to introduce aCOMMAND-NAMEkeyword argument
Neat, that would do the trick, thanks. Do I need to do anything special to open a PR?