def setup_commandline_args(parser):
    """
    Takes an argparse.ArgParser instance and adds extra options.
    (Allows the parser generated by mytardis_uploader to be extended
     with extra options specific to illumina_uploader)

    :param parser: The parser to extend with additional options.
    :type parser: argparse.ArgumentParser
    :return: The extended parser.
    :rtype: argparse.ArgumentParser
    """
    parser.add_argument('--fastq-only',
                        dest='fastq_only',
                        action='store_true',
                        help="Ingest just the FASTQ files and "
                                "ignore any instrument / run specific "
                                "files or metadata extraction. FastQC "
                                "reports are generated if the --run-fastqc "
                                "flag is also given.")
    parser.add_argument('--threads',
                        dest='threads',
                        type=int,
                        metavar='THREADS')
    parser.add_argument('--run-fastqc',
                        dest='run_fastqc',
                        type=bool,
                        default=False,
                        metavar='RUN_FASTQC')
    parser.add_argument('--fastqc-bin',
                        dest='fastqc_bin',
                        type=str,
                        metavar='FASTQC_BIN')
    parser.add_argument('--bcl2fastq-output-path',
                        dest='bcl2fastq_output_path',
                        default='{run_path}/Data/Intensities/BaseCalls',
                        type=str,
                        metavar='BCL2FASTQ_OUTPUT_PATH',
                        help='The path to the bcl2fastq output '
                                '(fastq.gz files in project/sample '
                                'directories). The template strings '
                                '{run_path} and {run_id} can be used to '
                                'specify a path relative to the run '
                                'folder, or another path that includes the '
                                'run_id.')
    parser.add_argument('--dump-fixtures',
                        dest='dump_fixtures',
                        action='store_true')
    parser.add_argument('--live-storage-box-name',
                        dest='live_storage_box_name',
                        default='live',
                        type=str,
                        metavar='LIVE_STORAGE_BOX_NAME')
    parser.add_argument('--replace-duplicate-runs',
                        dest='replace_duplicate_runs',
                        type=bool,
                        default=False,
                        metavar='REPLACE_DUPLICATE_RUNS')
    parser.add_argument('--ignore-zero-sized-bcl-check',
                        dest='ignore_zero_sized_bcl_check',
                        type=bool,
                        default=False,
                        metavar='IGNORE_ZERO_SIZED_BCL_CHECK')

    return parser