l3nz / cli-matic

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

[Ftr]Run functions for both a command and its subcommands? #165

Open liotev opened 1 month ago

liotev commented 1 month ago

Hi, as far as I can see, if a command has a :runs function, then even if it has :subcommands, they are simply ignored. Is there any way to have :runs functions both for a command and its sub commands?

I mean if we take Git as an example, there is the git remote command which shows remotes, but it also has sub commands, for example git remote add, git remote rename etc.

Is it possible to have this pattern with the current version of cli-matic?

l3nz commented 1 month ago

No, actually I never thought about it. How ould you determine whether a command is a command or a subcommand?

liotev commented 1 month ago

How would you determine whether a command is a command or a subcommand?

I will have a look at the code to see if I can come up with any ideas.