Open x3rAx opened 7 years ago
@x3rAx Hi, thanks for your suggestions, though I would prefer the way #33 suggests.
Actually I would agree that it might not be a real performance issue most of the time, not to mention we could have an option for that. However, it's not necessary either as the subcommands
entry would be seldom edited. 😂
I think it would be nice to be able to set the alias inside the subcommand file using the
@command()
decorator.It is currently only possible to defined aliases in the parent command by exporting a
SubcommandDefinition
array:This way, I will have to maintain the alias in a separate file from the actual subcommand definition file. And it is very easy to forget changing the command definition in the parent command when for example renaming the subcommand.
In this case one would end up with the new command name (without an alias) and the old one (with alias but not working as it is not defined anymore).
When setting the alias in the
@command()
decorator, this would not happen.Drawbacks
Using this method, every subcommand has to be loaded when executing a subcommand using its alias because clime does not know which command has the given alias. This might produce some unwanted IO, especially in larger applications with many subcommands. But I don't know if this would really be a problem
Solution 1
This behavior could be configurable while bootstrapping clime:
Solution 2
Don't allow this at all if there are too may concerns but at least let the developer know that something is wrong. (See #33)