DocOpt.jl icon indicating copy to clipboard operation
DocOpt.jl copied to clipboard

Cannot put mandatory argument after optional ones?

Open blaiseli opened this issue 6 years ago • 0 comments

Consider the following usage description:

Usage:
  qaf_demux.jl [-i <input_fastq> | --input_fastq <input_fastq>] (-o <output_dir> | --output_dir <output_dir>) -b <barcode> -s <barcode_start> [-m <max_diff>]

-h --help                                 Show this help message and exit.
-i --input_fastq <input_fastq>            Fastq file to demultiplex. Default is to read from stdin.
-o --output_dir <output_dir>              Directory in which to put demultiplexed fastq files.
-b --barcode <barcode>                    Barcodes to which the reads should be attributed.
-s --barcode_start <barcode_start>        Position at which the barcode starts (1-based).
-m --max_diff <max_diff>                  Only assign a record to one of the barcodes if it has no more than *max_diff* differences in its barcode portion. [default: 3]

My script is complaining if I specify the mandatory option -o after the optional argument -m on my command-line:

ERROR: LoadError: ArgumentError: invalid base 10 digit '/' in "/tmp/test_qaf_demux"

If I put the -o earlier, it is fine.

(The script is also complaining if I do not provide option -m, because it doesn't populate the args with the desired default value "-m"=>false,"<max_diff>"=>nothing, but I should probably report this as a separate issue.)

blaiseli avatar Aug 12 '19 15:08 blaiseli