FU Logo
  • Startseite
  • Kontakt
  • Impressum
  • Home
  • Listenauswahl
  • Anleitungen

Re: [Seqan-dev] ArgParseArgument list allowing zero or more items?

<-- thread -->
<-- date -->
  • From: Rahn, René <rene.maerker@fu-berlin.de>
  • To: SeqAn Development <seqan-dev@lists.fu-berlin.de>
  • Date: Thu, 28 Jul 2016 12:00:32 +0200
  • Reply-to: SeqAn Development <seqan-dev@lists.fu-berlin.de>
  • Subject: Re: [Seqan-dev] ArgParseArgument list allowing zero or more items?

Hi Bernie, 

thank you very much for writing us. 
I'd like you to raise such questions on the issue site on our github page: https://github.com/seqan/seqan/issues.
The mailing list is not-so-up-to-date anymore, and we will probably use this mailing list merely as a news feeder in the future to inform you about new releases or training courses.

Thank you very much for you understanding.

Kind regards,

René

On 10 Jul 2016, at 08:35, Bernard James Pope <bjpope@unimelb.edu.au> wrote:

Hi SEQAN devs,

I'm writing a program which accepts zero or more FASTA files on the command line, as positional arguments.

If zero files are specified, then it will default to reading from standard input.

I want to write a Seqan argument parser to capture this behaviour. However, I seem stuck with a solution that requires at least one file to be specified.

Here's a sketch of what I have:

  ArgumentParser parser(PROGRAM_NAME);
  addOption(parser, ArgParseOption("f", "foo", "Silly example", ArgParseArgument::INTEGER, "INT"));

  addArgument(parser, ArgParseArgument(ArgParseArgument::STRING, "FASTA_FILE", true));

  ArgumentParser::ParseResult res = parse(parser, argc, argv);

Notice that isListArgument is set to true.

However, when I run my program, and specify zero positional arguments (but some other option arguments), e.g.

   $ myprogram -foo 0

I get the error:

   Not enough arguments were provided.

Is there a way to achieve what I want to do?

I thought I might be able to default the ArgParseArgument to be an empty vector somehow, but couldn't get that to work.

If anyone has used the Python ArgumentParser before, the behaviour I want to emulate is the ability to specify nargs='*'

Cheers,
Bernie
_______________________________________________
seqan-dev mailing list
seqan-dev@lists.fu-berlin.de
https://lists.fu-berlin.de/listinfo/seqan-dev

---

René Rahn
Ph.D. Student (de.NBI - CIBI)
--------------------------------
Tel:  (+49) 30 838 75137
Mail: rene.rahn@fu-berlin.de
--------------------------------
Institute of Computer Science
Algorithmic Bioinformatics (ABI)
--------------------------------
Freie Universität Berlin
Takustraße 9
14195 Berlin
--------------------------------

<-- thread -->
<-- date -->
  • Follow-Ups:
    • Re: [Seqan-dev] ArgParseArgument list allowing zero or more items?
      • From: Bernard James Pope <bjpope@unimelb.edu.au>
  • References:
    • [Seqan-dev] ArgParseArgument list allowing zero or more items?
      • From: Bernard James Pope <bjpope@unimelb.edu.au>
  • seqan-dev - July 2016 - Archives indexes sorted by:
    [ thread ] [ subject ] [ author ] [ date ]
  • Complete archive of the seqan-dev mailing list
  • More info on this list...

Hilfe

  • FAQ
  • Dienstbeschreibung
  • ZEDAT Beratung
  • postmaster@lists.fu-berlin.de

Service-Navigation

  • Startseite
  • Listenauswahl

Einrichtung Mailingliste

  • ZEDAT-Portal
  • Mailinglisten Portal