Open JavaDev99 opened 4 years ago
As far as I understand correctly it is a matter of not supporting "subcommands going up the hierarchy" that was asked about here: https://github.com/remkop/picocli/issues/454#issuecomment-580972877
If this is the case, would it be possible to enhance the picocli in a way that would allow for scenarios like the one posted above? It would be great to have this feature ;)
@JavaDev99, @r2mzes's comment is correct. Currently picocli's repeatable subcommands do not support this.
I will look into whether it is feasible to support this.
I have this need too : https://github.com/remkop/picocli/issues/2133
Must-Have Feature
I think a bit more about it and it seems to me that having a way to support subcommand going up the hierarchy
is really a must-have feature.
You could answer that this is still possible to flattening the commands hierarchy OR massively use options but this often lead to ugly CLI in complex use cases.
I feel this is like if GUI library doesn't allow you to create submenu (or submenu is allowed only as last element of menu) and so the alternative was "put all action in same menu"
Something smelly with Current Behavior :
I really think that current behavior is counterintuitive :thinking: .
From CLI user perspective (I mean users who use CLI, not developers who use picocli library), it will be really hard to understand that he :
toplevelcmd subcmd-A subcmd-B subsubB
toplevelcmd subcmd-B subsubB subcmd-A
I feel it would be clearer to allow both OR forbid both.
Imagine you have an image transformation tool.
You can do :
// convert to grayscale then save
java -jar jimage.jar
color -to-grayscale
save "image_before_transformation.png"
// convert to grayscale then save, then rotate then mirror
java -jar jimage.jar
color -to-grayscale
save "image_before_transformation.png"
transform rotate -degree 90
transform mirror -vertical
But you can not do :
// convert to grayscale then save, then rotate then mirror, then save again.
java -jar jimage.jar
color -to-grayscale
save "image_before_transformation.png"
transform rotate -degree 90
transform mirror -vertical
save "image_after_transformation.png"
@sbernard31 sorry but I’m too swamped to work on picocli at the moment.
For that last use case one idea is to add the save
command as a subcommand to transform also…
sorry but I’m too swamped to work on picocli at the moment.
Of course as a user I am disappointed :disappointed:. But I also manage an open source project, so I totally understand that you could haven't time now. Could I ask if that means : "there is no chance, I work on it in next week ? month ? or year ? or more ?"
I'm sorry if I seem too pushy but unfortunately users have only 1 power to impact project they depend on : discuss and provide argument hoping maintainer will agree.
For that last use case one idea is to add the save command as a subcommand to transform also…
Yep, but you need to :
transform
command subcommandsRepeatable=true
(maybe you don't want to allow that) Maybe you will succeed to have something OK from users point of view but now for sure your code is hard to maintain.
Hi, @remkop, any news about that ?
Hi @sbernard31, sorry but I cannot see myself working on this in the foreseeable future.
@remkop, ok I understand.
Eventually, if could try to work on it, if I do :
We are trying to implement this code
And we get the following error.
Could you tell us what solution may be for this