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
Extract sub-command handling (alr <command>) #806
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neat! I just saw very little things during the review. There is some ugliness that I crafted in there, ouch. Way better having it isolated.
I understand that now alr build
simply doesn't see the -X
switches. I remember that someone was using that. Perhaps this PR can go in after 1.1
then.
6c20d47
to
4512319
Compare
@mosteo I did my final refactoring on this. Pending checks and reviews, the remaining questions are:
|
6bf4cb4
to
5565a61
Compare
Huge effort here, thanks Fabien.
Nowadays I don't see a reason for huge libraries, so I favor splitting things unless they're very thematically related. AAA is going to probably be my last hodgepodge project. So I'd say its own crate.
Besides the camel case (I'd prefer simply |
Thank you, I was not expecting to fall in this rabbit hole ^^
Thinking about this, we have other things like TTY, user input, config files that we can extract from Alire in to a Command Line Interface crate:
Ok for |
I like this one a lot, |
I use |
e257c47
to
7bc6c0b
Compare
@mosteo I successfully moved I think |
Thanks for the update, @Fabien-Chouteau . @onox, the |
4a945ca
to
9eaf033
Compare
The goal of this big refactoring is to extract the handling of sub-commands to make it available for other projects. The SubCommander packages (name open to changes) can be extracted to a dedicated crate or to AAA. There is at least one regression which is the support of -X for alr build.
The switches are not parsed several times like before. The global switches parsing is done once, the command specific switch parsing is done only on the command arguments. Handling of -X scenario variable switches is now done with regular GNAT.Command_Line switch handling. There is a issue with command arguments that contain spaces, it looks like they are split in multiple arguments. I don't know why.
The concatenation of arguments and re-splitting with GNAT.OS_Lib.Argument_String_To_List breaks when arguments have whitespaces: 'alr' 'show' 'a b c' becomes 'alr 'show' 'a' 'b' 'c'.
This was previously done with a GNAT.Command_Line.Extra package that exploited the internals of GNAT.Command_Line. This is more portable because less exposed to changes in the internals of GNAT.Command_Line.
9eaf033
to
f57fa42
Compare
Thanks a lot, Fabien, now merged. |
The goal of this big refactoring is to extract the handling of
sub-commands to make it available for other projects.
The SubCommander packages (name open to changes) can be extracted to a
dedicated crate or to AAA.
There is at least one regression which is the support of -X for alr
build.