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

How we suggest command lining #21

wants to merge 1 commit into
base: public

How we suggest command lining #21

wants to merge 1 commit into from


Copy link

@ctb ctb commented May 27, 2018

See rendered version

Comments welcome

@ctb ctb changed the base branch from master to public May 27, 2018
Copy link
Owner Author

@ctb ctb commented May 28, 2018

Copy link

@sjackman sjackman commented May 28, 2018

Handle multiple sets of multiple input files in a tab-completion friendly manner.

sourmash lca gather --query query1.sig query2.sig --db db1.sig db2.sig

It's unfortunately not easy to parse this command line using standard option parsing libraries, or perhaps not even possible with some libraries. Named arguments like --query and --db can take either 0 or 1 argument, but I'm most don't allow for 2+ arguments. The first step of some option parsing libraries is to move all the named options to the front of the command line, so the above becomes the following before the results are seen by caller of the library function.

sourmash lca gather --query --db -- query1.sig query2.sig db1.sig db2.sig

where -- indicates the separation between the named arguments and the positional arguments.

One notable example is C's getopt and getopt_long.

The default is to permute the contents of argv while scanning it so that eventually all the non-options are at the end. This allows options to be given in any order, even with programs that were not written to expect this.

One possible solution is to repeat the named option.

sourmash lca gather --query=query1.sig --query=query2.sig --db=db1.sig --db=db2.sig
sourmash lca gather -q query1.sig -q query2.sig -d db1.sig -d db2.sig

A possible refinement is to make the most common option positional arguments and the other named arguments.

sourmash lca gather --db=db1.sig --db=db2.sig query1.sig query2.sig query3.sig query4.sig
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants