-
Notifications
You must be signed in to change notification settings - Fork 490
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
feat(cmd): avoid to use CommandAttributes::flags directly #2619
Conversation
Is this to avoid not calling |
Exactly. |
What about making it private to avoid some explicit calling? ( Current method lgtm but I think it's easy to use it directly next time) |
Done. |
Also I plan to make key_range and other related members private in the next PR. |
@@ -182,9 +228,11 @@ struct CommandAttributes { | |||
// commander object generator | |||
CommanderFactory factory; | |||
|
|||
uint64_t InitialFlags() const { return flags_; } |
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.
Minor question: why InitialFlags()
in some cases?
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.
Some times we cannot get the cmd args, so maybe the initial flags is useful. Also I currently don't want to touch some legacy sources.
template <typename T> | ||
auto MakeCmdAttr(const std::string &name, int arity, const std::string &description, NoKeyInThisCommand no_key, | ||
const AdditionalFlagGen &flag_gen = {}) { | ||
CommandAttributes attr(name, arity, CommandCategory::Unknown, ParseCommandFlags(description, name), flag_gen, no_key, |
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.
So NO_KEY has becoming a different ctor fn?
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.
Yeah, 0,0,0
is not clear enough.
Quality Gate passedIssues Measures |
We should use
CommandAttributes::GenerateFlags
instead of accessing theflags
member directly.