Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Rc 0.6.0 #63
Rc 0.6.0 #63
Changes from all commits
a18c17e
30e90ed
23a0f3c
c805502
3f5d2a0
a539faa
56a5c3d
649303a
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
I would recommend against
Parser
andParser
as that can be confusing even if they do operate in different namespaces.As for
to_options
:done
, et all implies it is built but it isn'tadd_info
focuses purely on adding context but there is more going onI would focus on the core of what it is. It is taking the lower level parsers and wrapping / building / turning them into a full application / user-facing / std::env::args parser.
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.
You also go though
OptionParser
when implementing commands and subcommands, making tests for your code or parsing things from sources other thanstd::env::args_os
. I think of it as a parser with some extra meta information attached. Interfacing with the lower level is done inside therun
method only - and that's the part that needs to be pluggable in order to support windows style flags FWIW.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.
Why
Parse
prefixes for the first three but not forNamedArg
?Personally, I would do
PositionalArg
Argument
Command
NamedArg
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.
First three are actually parsers that can extract something,
NamedArg
needs.flag
,.switch
or.argument
to become one. At the moment any primitive parser starts withParse
so naming is consistent.For
Command
- when messing with passing arguments tocargo
I found it confusing when there's several things namedCommand
sitting in one namespace: one frombpaf
and one fromstd::process::Command
. Having distinct names helps to reduce this kind of confusion. I guess I'll poke my coworkers as well for the input.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.
I renamed
clap::App
toclap::Command
back in 3.1.0 and no one has brought up concerns over naming conflicts. Granted, it was only deprecated and in clap 3.2 we made deprecations opt-in. We'll see when clap v4 comes out.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.
Well. For that to be reported you need a bunch of factors:
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.
(1) seems irrelevant. You just need to deal with
Command
in the same mod. This can happen because of that, because of howcargo run --
works, or just because(2) depends on if you do
use clap::Command
. Personally, I don't. I only like usinguse
for traits.This file was deleted.
This file was deleted.
This file was deleted.