rotifer.core.cli.action#

class rotifer.core.cli.action[source]#

Bases: object

Rotifer’s parser custom actions!

class add_stdin(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)[source]#

Bases: Action

An action to add the standard input to a list of input files and warn if any of these files cannot be read.

class autoload(option_strings, file_type='list', kw={'duplicates': True}, *args, **kwargs)[source]#

Bases: Action

An action to decide file type, open, and load the file into memory, close after So far it decide if string, file, stdin Optional parameters:

duplicates = Boolean [True/False] duplicates = True, remove duplicate lines duplicates = False, keep duplicate lines

class autoopen(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)[source]#

Bases: Action

An action to decide file type, and open.

class buffer_stdin(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)[source]#

Bases: Action

An action to save the contents of the standard input to a temporary file and add this file to the list of input files, warning the user if any input file cannot be read.

class dict_options(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)[source]#

Bases: Action

An action to use with nargs = ‘1’, will return a list of dict, separator is ‘=’ Usage in command line -arg my=1 -arg yours=2 Result: args.arg = [{my : 1}, {yours : 2}]

class dict_options_dev(option_strings, default={}, *args, **kwargs)[source]#

Bases: _AppendAction

An action to use with nargs = ‘1’, will return a list of dict, separator is ‘=’ Usage in command line -arg my=1 -arg yours=2 Result: args.arg = [{my : 1}, {yours : 2}]

class extend(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)[source]#

Bases: Action

add_stdin_to_list_of_input_files(parser, largs)[source]#

Add the standard input, if active, to the list of input files provided as arguments.

The first element of the list that is equal to “-” is replaced by the standard input. All other ocurrences of “-” are treated as a file named “-“.

Only files that exist are kept in the final list

openread(parser, largs)[source]#

Open, read, and close a file. Remove duplicates

openread2(parser, largs)[source]#

Open, read, and close a file. Keep duplicates.