def _parse_args(): parser = argparse.ArgumentParser( description='Convert .gitignore patterns to glob patterns') parser.add_argument('-v', '--verbose', action='count', default=0, help='increase output verbosity') parser.add_argument( '-g', '--no-git', action="store_true", help='do not add .git and .github into the returned patterns') parser.add_argument('-s', '--seperator', default='|', help='string to seperate output globs') parser.add_argument( '-w', '--wrapper', default='', help= 'string to specify, what if any, text to wrap the individual output') parser.add_argument('filenames', nargs='+', metavar='<.gitignore>', type=file_exists, help=\ 'specify which gitignore files to convert') args = parser.parse_args() app_settings.update(vars(args)) app_settings.print_settings(print_always=False)
def _parse_args(): default_conf_path = _get_default_conf_path() parser = argparse.ArgumentParser( description= 'Helper script which looks up login info and caches it in sqlite3 databse' ) config_group = parser.add_mutually_exclusive_group() parser.add_argument('-v', '--verbose', action='count', default=0, help='increase output verbosity') parser.add_argument('-d', '--databse', metavar='<DB PATH>', help='directory to find and store databse') config_group.add_argument('-c', '--config', default=argparse.SUPPRESS, type=_existing_conf_path, metavar='<CONFIG PATH>', help='config ini file to specify parameters') config_group.add_argument('-w', '--write-default-config', dest='write_config', default=argparse.SUPPRESS, type=_new_conf_path, metavar='<CONFIG PATH>', help='write default ini file') args = parser.parse_args() app_settings.update(vars(args)) app_settings.print(f'config: {app_settings.config}') app_settings.print(f'write config: {app_settings.write_config}') app_settings.print_settings(print_always=False)
def _parse_args(): parser = argparse.ArgumentParser(description='Backup Github repositories') parser.add_argument('-v', '--verbose', action='count', default=0, help='increase output verbosity') parser.add_argument('-u', '--username', required=True, default='jasonivey', help='username of the Github account to backup') parser.add_argument('-d', '--destination', required=True, default='/tmp/github-backups', help='destination directory for Github backups') parser.add_argument('repositories', metavar='repository', nargs='*', action='append', help='specify which repositories to backup') args = parser.parse_args() app_settings.update(vars(args)) app_settings.print_settings(print_always=False)
def _parse_args(): parser = argparse.ArgumentParser( description= 'Replacement for standard Linux banner for both OS X and Linux') parser.add_argument('-v', '--verbose', action='count', default=0, help='increase output verbosity') args = parser.parse_args() app_settings.update(vars(args)) app_settings.print_settings(print_always=False)
def _parse_args(): parser = argparse.ArgumentParser( description= f'Generate random password from [{string.ascii_lowercase + string.ascii_uppercase + string.digits + string.punctuation}] characters' ) parser.add_argument('-v', '--verbose', action='count', default=0, help='increase output verbosity') parser.add_argument( '-c', '--count', type=int, default=32, help='how many total characters should be in the password') parser.add_argument( '-l', '--lower-case', type=int, default=1, help='how many lower case letters must be in the password') parser.add_argument( '-u', '--upper-case', type=int, default=1, help='how many upper case letters must be in the password') parser.add_argument('-n', '--numbers', type=int, default=1, help='how many numbers must be in the password') parser.add_argument( '-p', '--punctuation', type=int, default=1, help='how many punctuation characters must be in the password') parser.add_argument('-x', '--exclude', type=str, default='', help='any characters which should not be allowed') args = parser.parse_args() app_settings.update(vars(args)) app_settings.print_settings(print_always=False)
def _parse_args(): parser = argparse.ArgumentParser( description='Find all of the subtitle files which are invalid') parser.add_argument('-v', '--verbose', action='count', default=0, help='increase output verbosity') parser.add_argument('-l', '--live-run', action="store_true", help='remove all of the invalid subtitle') parser.add_argument( 'directories', metavar='PATH', type=_is_valid_directory, nargs='+', help='one or more directories to search for invalid subtitles') args = parser.parse_args() app_settings.update(vars(args)) app_settings.print_settings(print_always=False)
def _parse_args(): parser = argparse.ArgumentParser(description='Pretty print environment variables') parser.add_argument('-v', '--verbose', action='count', default=0, help='increase output verbosity') parser.add_argument('-r', '--raw', action='store_true', help='print variables how they are found in the environment') parser.add_argument('-o', '--one-line', action="store_true", help='print variables with multiple values on one line') parser.add_argument('-l', '--list-env', action="store_true", help='list environment variables names currently defined') parser.add_argument('-L', '--list-env-values', action="store_true", help='list environment variables names currently defined and values') parser.add_argument('-s', '--seperator', default=':', metavar='<CHAR>', help='set which character to split multi-value environment variables') parser.add_argument('-i', '--identifier', metavar='<VALUE1:VALUE2:VALUE3>', help='out a specified list of identifiers by splitting them to using the <seperator>') parser.add_argument('variables', nargs='*', metavar='<ENV-VAR>', help='specify which environment variables should be printed') args = parser.parse_args() app_settings.update(vars(args)) app_settings.print_settings(print_always=True) if _is_only_defaults_set(): app_settings.variables.append('PATH') # these should be fixed with a mutually exclusive group if app_settings.variables and len(app_settings.variables) > 0 and (app_settings.list_env or app_settings.list_env_values): parser.error('attempting to print environment variables and to list all defined environment variables -- choose one!') app_settings.print_settings(print_always=False)