Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scoping of subcommands #5

Open
alessiostalla opened this issue Jul 24, 2021 · 3 comments
Open

Scoping of subcommands #5

alessiostalla opened this issue Jul 24, 2021 · 3 comments

Comments

@alessiostalla
Copy link

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

@svetlyak40wt
Copy link
Member

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

@svetlyak40wt
Copy link
Member

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.

@alessiostalla
Copy link
Author

If you want, you can modify DEFCOMMAND macro and to introduce a COMMAND-NAME keyword argument

Neat, that would do the trick, thanks. Do I need to do anything special to open a PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants