def _register_app_args(self, h: OptionContext): if self._version: h.add_custom_decorator(lambda: click.version_option(self._version)) h.add_option('--cwd', dest='cwd', help='Change to specified directory') h.add_option('--wait', is_flag=True, help='Wait for user input before terminating application') h.add_option('--print-backtraces', dest='print_backtraces', is_flag=True, help='Print backtraces of the exceptions') debug_opts = ['--debug'] if self._enable_short_debug_option: debug_opts.insert(0, '-d') h.add_option(*debug_opts, dest='debug', is_flag=True, help='Enable print/log debug messages') if self._enable_env_options: h.add_option( '-e', '--environment', dest='environment', help=f'Specifies the environment to run the app ' f'under ({"/".join(sorted(self._env_config.available_envs))})') logging = h.add_group('Logging') logging.add_option('--log-level', dest='log_level', help='Set log level, default: warning', type=click.Choice( [i.name.lower() for i in LogLevel]), default='info') logging.add_option( '--log-syslog', dest='log_syslog', is_flag=True, help='Log to syslog. Can be combined with other log targets') logging.add_option( '--log-console', '--log-stdout', dest='log_console', is_flag=True, help= 'Log to STDOUT, the console. Can be combined with other targets.' 'If no target is specified, this is used as default.') logging.add_option( '--log-file', dest='log_file', multiple=True, help='Log to a file. Can be specified multiple times and ' 'can be combined with other options.') logging.add_option( '--no-log', '-l', dest='log_none', is_flag=True, help='Disable logging. If this is set, other targets are invalid.')
def register_arguments(c: OptionContext): c.add_option('--filter', '--filter-file', dest='filter_file', required=True, help='File of filters') c.add_option('--sql', '--sqlite-db', '--db', '-d', dest='db', required=True, help='SQLite database to read and update') c.add_option('--target-directory', dest='target', required=True, help='Target directory to store unique files') c.add_option('--log-file', dest='log_file', required=True, help='Log file for detailed run') c.add_option('--dry-run', '-n', dest='dry_run', is_flag=True, help='Do change file system, just print what would do')
def register_arguments(c: OptionContext) -> None: GerritChangeReviewer.register_arguments(c) # register own arguments c.add_option('-r', '--repo', 'gerrit_review_local_repo', help='Conflicts with parent command, should work')
def register_arguments(c: OptionContext): c.add_option( '--filter', '--filter-file', dest='filter_file', required=True, help='File of filters') c.add_option( '--sql', '--sqlite-db', '--db', '-d', dest='db', required=True, help='SQLite database to read')
def register_arguments(c: OptionContext): c.add_option('-i', '--input', required=True, help='The CSV file to process') c.add_option('-o', '--output', required=False, help='The output CSV filename')
def register_directory_args(c: OptionContext): c.add_option( '-d', '--directory', '--source-directory', dest='directory', required=True, help='The local root directory which contains files to be synced' ) c.add_option( '-t', '--target-directory', dest='target_directory', required=True, help='The target root directory, everything will be synced below this directory' )
def register_arguments(c: OptionContext): c.add_option('-p', '--port', type=int, default=8081, help='The port number, default: 8081') c.add_option( '--count', default='40M', help='Amount of bytes. Can be used the K/M/G suffix. Default: 40M')
def register_sync_entries(c: OptionContext): c.add_option( '-e', '--entry', required=True, multiple=True, help='A file sync entry describing what to synchronize in format' ' source;target;permissions;owner;group;flags' ) c.add_option( '-n', '--no-chmod-chown', '--skip-chmod', dest='skip_chmod', is_flag=True, default=False, help='Always skip chmod and chown (to run as non-admin on target FS)' )
def register_arguments(c: OptionContext): c.add_option('-s', '--smaller-than', dest='smaller_than', type=int, help='Print till the primes are smaller than this value.') c.add_option( '-c', '--count', type=int, help= 'Max number of printed primes (if --smaller-than is not specified, count is 100)' )
def register_arguments(c: OptionContext): c.add_option('--wait-for-close', help='Wait a minute before closing Chrome', is_flag=True) driver_grp = c.add_group( 'Browser and WebDriver options', help='Options influences the behaviour of Selenium Web Driver and Google Chrome / Firefox') driver_grp.add_option('--screenshots', '--screenshot-dir', dest='screenshot_dir', default='.', help='The directory to save any screenshot, default: current directory') driver_grp.add_option('--download-directory', '--dl-dir', dest='download_dir', required=True, help='Download directory') driver_grp.add_option('--headless', is_flag=True, help='Start Chrome in headless mode') driver_grp.add_option('--timeout', type=int, default=60, help='Timeout for waiting any element or action, default: 60s')
def register_arguments(c: OptionContext): c.add_option( '-s', '--source', '--source-directory', dest='source_dir', required=True, help='Source Directory of files (photos) to be checked and cleaned' ) c.add_option('--sql', '--sqlite-db', '--db', '-d', dest='db', required=True, help='SQLite database to store data')
def register_arguments(c: OptionContext): c.add_option( '-v', '--verbose', is_flag=True, default=False, dest='verbose', help='Verbose output, prints the details of hashed values') grp = c.add_mutually_exclusive_group(required=True) grp.add_option( '--phash', '--python-hash', dest='phash', metavar='PYTHON-DIR', help= 'Calculate MD5 hex digest of a directory without .git and __pychache__' )
def register_global_args_in_review_cmd(c: OptionContext) -> None: """ Register global args not listed in the subcommands but in parent ReviewCommand. Added here just to be always visible in this module. """ c.add_option('-U', '--gerrit-ssh-user', 'gerrit_ssh_user', help='SSH username to send review into gerrit') c.add_option( '--upload-gerrit-review', '--review', 'upload_gerrit_review', is_flag=True, help= 'Upload gerrit review. By default the code uses dry run and print the review instead.' ) c.add_option('-R', '--repo', 'gerrit_review_local_repo', required=True, help='Location of the bare git repository. ' 'Can be an existing repo or a non-existent directory.')
def register_arguments(c: OptionContext): c.add_option( '-s', '--source', '--source-directory', dest='source_dir', required=True, help='Source Directory of files (photos) to be checked and cleaned') c.add_option( '-d', '--destination', '--destination-directory', dest='dest_dir', required=True, help='Target Root Directory - Files will be copied to $TARGET/$YEAR/$YEAR-$MONTH/$YEAR-$MONTH-$DAY') c.add_option( '--pretend', dest='pretend', default=False, is_flag=True, help='Pretend only, but do not move files')
def register_arguments(c: OptionContext): c.add_option( '--sql', '--sqlite-db', '--db', '-d', dest='db', required=True, help='SQLite database to read and update') c.add_option('--log-file', dest='log_file', required=True, help='Log file for detailed run') c.add_option('--dry-run', '-n', dest='dry_run', is_flag=True, help='Do change file system, just print what would do')
def _register_ssh_args(c: OptionContext): c.add_option( '-H', '--host', required=True, help='The SSH server\'s host name or IP address' ) c.add_option( '-p', '--port', type=int, default=22, help='The SSH sever port, default is 22' ) c.add_option( '-l', '--login', '-u', '--user', dest='user', required=True, help='The username used on the SSH server' ) c.add_option( '--skip-host-key-check', is_flag=True, default=False, help='Skip check SSH host key - it is insecure, but in trusted environment it is reasonable' )
def register_arguments(c: OptionContext): c.add_option('--gerrit-url', dest='gerrit_url', required=True, help='Gerrit URL without revision ID') c.add_option( '--change-id', 'change_id', type=int, help='Change ID, should be the same as the end of the gerrit URL') c.add_option('--gerrit-revision', '--revision', 'revision', type=int, required=True, help='Revision of the change in gerrit url')
def register_arguments(c: OptionContext): c.add_option( '-d', '--directory', '--target-directory', dest='directory', required=True, help= 'An empty or non-existant directory where the splitted logs will be' ) c.add_option( '--reopen', dest='reopen', help= 'Reopen each file when appending to it instead of store handles.' ' It works with thousands of sessions but it is very slow') c.add_option('-s', '--silent', dest='silent', is_flag=True, help='Do not print status, the line numbers') c.add_option( '-D', '-m', '--delimiter', dest='delimiter', default='.' if sys.platform == 'win32' else ':', help= 'Delimiter character used in filename, default: same as in session_id, the colon' ) c.add_argument( 'zorplogfile', nargs=1, default='-', help= 'The original Zorp log file to be splitted. Omit or use - to read from stdin' )
def register_arguments(c: OptionContext): c.add_option('--reprocess', '-f', '--force', is_flag=True, dest='reprocess', default=False, help='Reprocess sysinfo if generated YAML file exists') c.add_option('--output', '-o', dest='output_dir', required=True, help='Output directory for result.yaml and index.html') c.add_option('--munin-dir', '-m', dest='munin_dir', default='/var/lib/munin', help='Munin directory, may not exist, default: /var/lib/munin') c.add_option('--log-dir', '-l', dest='log_dir', default='/var/log', help='Log directory, may not exist, default: /var/log') c.add_option('--no-logs', '-L', is_flag=True, dest='no_log', default=False, help='Skip processing logs') c.add_option('--no-graphs', '-G', is_flag=True, dest='no_graph', default=False, help='Skip generating munin graphs')
class OptionContextTest(_InvokableTestBase): def test_embedded_groups(self): params = dict() def f(p): nonlocal params params = p self.tested = OptionContext() self.tested.add_option('--first-option', help='The first option') grp = self.tested.add_group() grp.add_option( '--grp1', dest='grp1arg', is_flag=True, ) self.tested.add_option( '--second-option', is_flag=True, ) grp2 = self.tested.add_group('A title') self.tested.add_option( '--3rd-option', dest='opt3', is_flag=True, ) grp2.add_option( '--grp2', dest='grp2arg', is_flag=True, ) grp.add_option( '--grp1-second', is_flag=True, ) r = self._invoke_redirected(self.tested, f, self.HELP_ARGS, expected_exit_value=0) self.assert_equal({}, params) self.assert_equal('', r.stderr.getvalue()) lines = r.stdout.getvalue().splitlines(keepends=False) self.assert_equal(11, len(lines)) self.assert_true(lines[0].startswith('Usage')) self.assert_equal([ 'Options:', _i('--first-option TEXT The first option', 1), _i('--grp1', 2), _i('--grp1-second', 2), _i('--second-option', 1), _i('A title: ', 1), _i('--grp2', 2), _i('--3rd-option', 1) ], lines[2:-1]) r = self._invoke_redirected(self.tested, f, ['--first-option', 'something'], expected_exit_value=0) self.assert_equal( { 'first_option': 'something', 'grp1arg': False, 'grp1_second': False, 'second_option': False, 'grp2arg': False, 'opt3': False }, params) self.assert_equal('', r.stdout.getvalue()) self.assert_equal('', r.stderr.getvalue())
def register_arguments(cls, c: OptionContext) -> None: Subcommand.register_arguments(c) c.add_option('-t', '--today', is_flag=True, default=False, help='Print stat of today only and the summary')
def register_arguments(cls, c: OptionContext) -> None: Subcommand.register_arguments(c) c.add_option('-s', '--source', required=True, help='The source .TXT file')
def register_arguments(cls, c: OptionContext): c.add_option('--filename', help='Filename or ~/WT.{ext} or ~/WORKTIME.{ext}'.format(ext=cls.ext))