-
Notifications
You must be signed in to change notification settings - Fork 4
Refactor CLI Enums to use clap::ValueEnum
#25
Conversation
@tareknaser thanks, it's better. But actually would be great to implement slightly different logic for |
EntryOutput
Enum to use clap::ValueEnum
clap::ValueEnum
Updated |
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.
Sorry, I meant a bit different handling of --entry
option.
The user can write --entry=id
or --entry=path
. I suggest refactor these long variants of the option into something simple but explicit like --id
and --path
. User may pass --id --path
to print both fields.
And we should support short option -ip
. So, the user could type -i
or --id
instead of --entry=id
. Also, -p
or --path
instead of --entry=path
.
Finally, -ip
should be shorthand for -i -p
or --id --path
. This is inspired by UNIX shell commands, e.g. ls -lah
is same as ls -l -a -h
.
Is this straightforward to implement using clappy
?
Alright, I just noticed that
Here are the changes I made to implement the structure you mentioned:
We will also refactor the CLI parameter processing to be handled within a method of the Let me know what you think |
That's ok. I think
Exactly what is needed, thanks. |
Do you want to do it in this PR or just create an issue for this moment? |
I've discovered this minor issue:
The output is not deterministic... It can be important when the output is used in pipe, the user could run one command, then craft very specific commands which should work with the particular output. If it changes, then the user's commands would not function correctly since they rely on the order. We have deterministic output when using
|
I have it implemented for this particular parameter ( |
It appears to be not deterministic regardless of the flags provided. Tracing this back, I don't think this is related to |
@tareknaser indeed, I didn't notice the ids starting with |
@tareknaser Could you create the follow-up issues? Feel free to merge after conflicts resolution. |
b925a81
to
c108825
Compare
I rebased this PR on top of main but I think it needs another review because some of the changes here conflicted with changes from #27 In #27, a new formatting option ("link") was added for the output of |
c108825
to
c1243f1
Compare
rebased on top of main but let's wait for ARK-Builders/ark-core#13 first to be merged and move this PR to |
Signed-off-by: Tarek <[email protected]>
c1243f1
to
ad73a4a
Compare
Done in ARK-Builders/ark-core#25 |
This change automatically prints the possible values to the user in the help message