Skip to content
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

[FIX] Throw missing subcommand argument on parse() and adapt misleading tutorial. #2179

Merged

Conversation

smehringer
Copy link
Member

Resolves #2172

@smehringer smehringer force-pushed the argument_parser_fix_subcommand_parsing branch from 4d1c645 to eeed52e Compare September 29, 2020 09:15
@eseiler eseiler changed the title [FIX] Throw missing subcommand argument on parse() and adapt mnisleading tutorial. [FIX] Throw missing subcommand argument on parse() and adapt misleading tutorial. Sep 29, 2020
Copy link
Member

@eseiler eseiler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have a few failing tests in the argparser

CHANGELOG.md Outdated Show resolved Hide resolved
@eseiler eseiler requested review from a team and rrahn and removed request for a team September 29, 2020 10:08
@codecov
Copy link

codecov bot commented Sep 29, 2020

Codecov Report

Merging #2179 into master will increase coverage by 0.12%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2179      +/-   ##
==========================================
+ Coverage   97.95%   98.07%   +0.12%     
==========================================
  Files         262      262              
  Lines       10047    10675     +628     
==========================================
+ Hits         9842    10470     +628     
  Misses        205      205              
Impacted Files Coverage Δ
include/seqan3/argument_parser/argument_parser.hpp 98.67% <100.00%> (+0.13%) ⬆️
include/seqan3/alignment/band/static_band.hpp 80.00% <0.00%> (-20.00%) ⬇️
include/seqan3/io/record.hpp 100.00% <0.00%> (ø)
include/seqan3/search/search.hpp 100.00% <0.00%> (ø)
include/seqan3/io/detail/misc.hpp 100.00% <0.00%> (ø)
include/seqan3/alphabet/concept.hpp 100.00% <0.00%> (ø)
test/include/seqan3/test/cereal.hpp 100.00% <0.00%> (ø)
include/seqan3/range/detail/misc.hpp 100.00% <0.00%> (ø)
include/seqan3/range/views/kmer_hash.hpp 100.00% <0.00%> (ø)
include/seqan3/io/sequence_file/input.hpp 100.00% <0.00%> (ø)
... and 129 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3d4e0d9...36190d3. Read the comment docs.

@smehringer smehringer force-pushed the argument_parser_fix_subcommand_parsing branch from 5c4a654 to 3cde399 Compare September 29, 2020 10:18
Copy link
Contributor

@rrahn rrahn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Some minor questions/remarks.

throw design_error{"The application name must only contain alpha-numeric characters or '_' and '-' "
"(regex: \"^[a-zA-Z0-9_-]+$\")."};

for (auto & sub : this->subcommands)
if (!std::regex_match(sub, std::regex{"^[a-zA-Z0-9_]+$"}))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the difference between the app_name_regex and this one? And why does it have different requirements then the app name? For Example no - sign?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me check..
So the subcommand parser name is automatically build with appname``-``subcommand, that's why the -. I don't remember adding the restriction but it was most probably me. I currently see no reason why this shouldn't be allowed.
I will fix that in a follow up PR though

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the design is that the subcommand parser needs to be called foo-bar insteaf of foo bar?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no the app is still called with ./foo bar on the command line. But the app name internally subparser.info.app_name is called foo-bar. A name is required and for the subparser I set the name internally, I guess I chose to add the top level parser to it 🤷 could disambiguate stuff in the future or with multiple nested parsers.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a follow up issue to track this seqan/product_backlog#234

include/seqan3/argument_parser/argument_parser.hpp Outdated Show resolved Hide resolved
test/unit/argument_parser/format_parse_test.cpp Outdated Show resolved Hide resolved
include/seqan3/argument_parser/argument_parser.hpp Outdated Show resolved Hide resolved
@smehringer smehringer requested a review from rrahn October 9, 2020 07:53
@smehringer
Copy link
Member Author

@rrahn polite ping

Copy link
Contributor

@rrahn rrahn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Can be rebased. Some minor documentation issue.

include/seqan3/argument_parser/argument_parser.hpp Outdated Show resolved Hide resolved
@smehringer smehringer force-pushed the argument_parser_fix_subcommand_parsing branch from 85fe614 to 36190d3 Compare October 15, 2020 14:28
@smehringer smehringer merged commit 9339af6 into seqan:master Oct 15, 2020
@smehringer smehringer deleted the argument_parser_fix_subcommand_parsing branch November 4, 2020 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Subcommand parser throws on constructions
3 participants