def cli_new():
    """
    Construct a CLI argument parser and return the parsed arguments.

    Returns
    -------
    Namespace
        A namespace object containing the parsed command-line arguments
    """
    parser = ArgumentParser()
    parser.add_argument('filename', help='Case file name', nargs='*')

    # general options
    general_group = parser.add_argument_group('General options')
    general_group.add_argument('-r', '--routine', choices=routines.__cli__,
                               help='Routine to run', nargs='*',
                               default=['pflow'], )
    general_group.add_argument('--edit-config', help='Quick edit of the config file',
                               default='', nargs='?', type=str)
    general_group.add_argument('--license', action='store_true', help='Display software license')

    # I/O
    io_group = parser.add_argument_group('I/O options', 'Optional arguments for managing I/Os')
    io_group.add_argument('-p', '--path', help='Path to case files', type=str, default='', dest='input_path')
    io_group.add_argument('-a', '--addfile', help='Additional files used by some formats.')
    io_group.add_argument('-D', '--dynfile', help='Additional dynamic file in dm format.')
    io_group.add_argument('-P', '--pert', help='Perturbation file path', default='')
    io_group.add_argument('-d', '--dump-raw', help='Dump RAW format case file.')
    io_group.add_argument('-n', '--no-output', help='Force no output of any '
                                                    'kind',
                          action='store_true')
    io_group.add_argument('-o', '--output_path', help='Output path prefix', type=str, default='')
    io_group.add_argument('-C', '--clean', help='Clean output files', action='store_true')

    config_exclusive = parser.add_mutually_exclusive_group()
    config_exclusive.add_argument('--load-config', help='path to the rc config to load',
                                  dest='config')
    config_exclusive.add_argument('--save-config', help='save configuration to file name',
                                  nargs='?', type=str, default='')

    # helps and documentations
    group_help = parser.add_argument_group('Help and documentation',
                                           'Optional arguments for usage, model and config documentation')
    group_help.add_argument(
        '-g', '--group', help='Show the models in the group.')
    group_help.add_argument(
        '-q', '--quick-help', help='Show a quick help of model format.')
    group_help.add_argument(
        '-c',
        '--category',
        help='Show model names in the given category.')
    group_help.add_argument(
        '-l',
        '--model-list',
        help='Show a full list of all models.',
        action='store_true')
    group_help.add_argument(
        '-f',
        '--model-format',
        help='Show the format definition of models.', nargs='*', default=[])
    group_help.add_argument(
        '-Q',
        '--model-var',
        help='Show the definition of variables <MODEL.VAR>.')
    group_help.add_argument(
        '--config-option', help='Show a quick help of a config option <CONFIG.OPTION>')
    group_help.add_argument(
        '--help-config',
        help='Show help of the <CONFIG> class. Use ALL for all configs.')
    group_help.add_argument(
        '-s',
        '--search',
        help='Search for models that match the pattern.')

    # simulation control
    sim_options = parser.add_argument_group('Simulation control options',
                                            'Overwrites the simulation configs')
    sim_options.add_argument(
        '--dime', help='Specify DiME streaming server address and port')
    sim_options.add_argument(
        '--tf', help='End time of time-domain simulation', type=float)

    # developer options
    dev_group = parser.add_argument_group('Developer options', 'Options for developer debugging')
    dev_group.add_argument(
        '-v',
        '--verbose',
        help='Program logging level.'
        'Available levels are 10-DEBUG, 20-INFO, 30-WARNING, '
        '40-ERROR or 50-CRITICAL. The default level is 20-INFO',
        type=int, default=20, choices=(10, 20, 30, 40, 50))
    dev_group.add_argument(
        '--profile', action='store_true', help='Enable Python cProfiler')
    dev_group.add_argument(
        '--ncpu', help='Number of parallel processes', type=int, default=0)
    dev_group.add_argument(
        '--show-data', type=str, help='Show model data converted to system base', nargs='*'
    )
    dev_group.add_argument(
        '-x', '--exit', help='Exit before running routine', action='store_true'
    )

    args = parser.parse_args()

    return args
def cli_new ( ) : parser = ArgumentParser ( ) parser . add_argument ( 'filename' , help = 'Case file name' , nargs = '*' ) general_group = parser . add_argument_group ( 'General options' ) general_group . add_argument ( '-r' , '--routine' , choices = routines . __cli__ , help = 'Routine to run' , nargs = '*' , default = [ 'pflow' ] , ) general_group . add_argument ( '--edit-config' , help = 'Quick edit of the config file' , default = '' , nargs = '?' , type = str ) general_group . add_argument ( '--license' , action = 'store_true' , help = 'Display software license' ) io_group = parser . add_argument_group ( 'I/O options' , 'Optional arguments for managing I/Os' ) io_group . add_argument ( '-p' , '--path' , help = 'Path to case files' , type = str , default = '' , dest = 'input_path' ) io_group . add_argument ( '-a' , '--addfile' , help = 'Additional files used by some formats.' ) io_group . add_argument ( '-D' , '--dynfile' , help = 'Additional dynamic file in dm format.' ) io_group . add_argument ( '-P' , '--pert' , help = 'Perturbation file path' , default = '' ) io_group . add_argument ( '-d' , '--dump-raw' , help = 'Dump RAW format case file.' ) io_group . add_argument ( '-n' , '--no-output' , help = 'Force no output of any ' 'kind' , action = 'store_true' ) io_group . add_argument ( '-o' , '--output_path' , help = 'Output path prefix' , type = str , default = '' ) io_group . add_argument ( '-C' , '--clean' , help = 'Clean output files' , action = 'store_true' ) config_exclusive = parser . add_mutually_exclusive_group ( ) config_exclusive . add_argument ( '--load-config' , help = 'path to the rc config to load' , dest = 'config' ) config_exclusive . add_argument ( '--save-config' , help = 'save configuration to file name' , nargs = '?' , type = str , default = '' ) group_help = parser . add_argument_group ( 'Help and documentation' , 'Optional arguments for usage, model and config documentation' ) group_help . add_argument ( '-g' , '--group' , help = 'Show the models in the group.' ) group_help . add_argument ( '-q' , '--quick-help' , help = 'Show a quick help of model format.' ) group_help . add_argument ( '-c' , '--category' , help = 'Show model names in the given category.' ) group_help . add_argument ( '-l' , '--model-list' , help = 'Show a full list of all models.' , action = 'store_true' ) group_help . add_argument ( '-f' , '--model-format' , help = 'Show the format definition of models.' , nargs = '*' , default = [ ] ) group_help . add_argument ( '-Q' , '--model-var' , help = 'Show the definition of variables <MODEL.VAR>.' ) group_help . add_argument ( '--config-option' , help = 'Show a quick help of a config option <CONFIG.OPTION>' ) group_help . add_argument ( '--help-config' , help = 'Show help of the <CONFIG> class. Use ALL for all configs.' ) group_help . add_argument ( '-s' , '--search' , help = 'Search for models that match the pattern.' ) sim_options = parser . add_argument_group ( 'Simulation control options' , 'Overwrites the simulation configs' ) sim_options . add_argument ( '--dime' , help = 'Specify DiME streaming server address and port' ) sim_options . add_argument ( '--tf' , help = 'End time of time-domain simulation' , type = float ) dev_group = parser . add_argument_group ( 'Developer options' , 'Options for developer debugging' ) dev_group . add_argument ( '-v' , '--verbose' , help = 'Program logging level.' 'Available levels are 10-DEBUG, 20-INFO, 30-WARNING, ' '40-ERROR or 50-CRITICAL. The default level is 20-INFO' , type = int , default = 20 , choices = ( 10 , 20 , 30 , 40 , 50 ) ) dev_group . add_argument ( '--profile' , action = 'store_true' , help = 'Enable Python cProfiler' ) dev_group . add_argument ( '--ncpu' , help = 'Number of parallel processes' , type = int , default = 0 ) dev_group . add_argument ( '--show-data' , type = str , help = 'Show model data converted to system base' , nargs = '*' ) dev_group . add_argument ( '-x' , '--exit' , help = 'Exit before running routine' , action = 'store_true' ) args = parser . parse_args ( ) return args
Construct a CLI argument parser and return the parsed arguments.

    Returns
    -------
    Namespace
        A namespace object containing the parsed command-line arguments