def parser(): parser = ArgParser(description='Nest Thermostat Flask') parser.add_argument('--use_hostname', '-u', action='store_true', help='Use hostname instead of localhost/127.0.0.1') parser.add_argument('--port', '-p', type=int, default=10000, help='Port to use') parser.add_common_arg('--config', '-c', metavar='PATH', default=DEFAULT_CONFIG_PATH, help='Config file location') parser.add_common_arg( '--reauth', '-A', action='store_true', help='Force re-authentication, even if a cached session exists') parser.include_common_args('verbosity') return parser
def parser(): parser = ArgParser( description='Download and merge split videos in a M3U8 playlist') parser.add_argument( 'source', help='URL that provides stream info or path to a .m3u8 file') parser.add_argument( '--name', '-n', help='The name of the video being downloaded (without extension)', required=True) parser.add_argument('--save_dir', '-d', default='~/Downloads/m3u8/', help='Directory to store downloads') parser.add_argument( '--local', '-l', action='store_true', help='Specify if the target ts part files already exist') parser.add_argument('--format', '-f', default='mp4', choices=('mp4', 'mkv'), help='Video format (default: %(default)s)') parser.add_argument('--goplay', '-g', action='store_true', help='The info url is a goplay.anontpp.com dl code') parser.add_argument( '--ffmpeg_dl', '-F', action='store_true', help= 'Have ffmpeg process the m3u8 and download the video parts instead (slower & more error prone)' ) parser.add_common_arg('--debug', '-D', action='store_true', help='Enable HTTP debugging') parser.include_common_args('verbosity', parallel=4) return parser
def parser(): # fmt: off parser = ArgParser(description='Music Manager GUI') with parser.add_subparser('action', 'open', help='Open directly to the Album view for the given path') as open_parser: open_parser.add_argument('album_path', help='The path to the album to open') with parser.add_subparser('action', 'clean', help='Open directly to the Clean view for the given path') as clean_parser: clean_parser.add_argument('path', nargs='+', help='The directory containing files to clean') wait_group = clean_parser.add_argument_group('Wait Options').add_mutually_exclusive_group() wait_group.add_argument('--multi_instance_wait', '-w', type=int, default=1, help='Seconds to wait for multiple instances started at the same time to collaborate on paths') wait_group.add_argument('--no_wait', '-W', action='store_true', help='Do not wait for other instances') with parser.add_subparser('action', 'configure', help='Configure registry entries for right-click actions') as config_parser: config_parser.include_common_args('dry_run') parser.include_common_args('verbosity') parser.add_common_arg('--match_log', action='store_true', help='Enable debug logging for the album match processing logger') # fmt: on return parser
def parser(): parser = ArgParser(description='Nest Thermostat Manager') status_parser = parser.add_subparser('action', 'status', 'Show current status') status_parser.add_argument('--format', '-f', default='yaml', choices=Printer.formats, help='Output format') status_parser.add_argument('--celsius', '-C', action='store_true', help='Output temperatures in Celsius (default: Fahrenheit)') status_parser.add_argument('--details', '-d', action='store_true', help='Show more detailed information') temp_parser = parser.add_subparser('action', 'temp', 'Set a new temperature') temp_parser.add_argument('temp', type=float, help='The temperature to set') temp_parser.add_argument('unit', nargs='?', default='f', choices=('f', 'c'), help='Unit (Celsius or Fahrenheit)') temp_parser.add_argument('--only_set', '-s', action='store_true', help='Only set the temperature - do not force it to run if the delta is < 0.5 degrees') range_parser = parser.add_subparser('action', 'range', 'Set a new temperature range') range_parser.add_argument('low', type=float, help='The low temperature to set') range_parser.add_argument('high', type=float, help='The high temperature to set') range_parser.add_argument('unit', nargs='?', default='f', choices=('f', 'c'), help='Unit (Celsius or Fahrenheit)') mode_parser = parser.add_subparser('action', 'mode', 'Change the current mode') mode_parser.add_argument('mode', choices=('cool', 'heat', 'range', 'off'), help='The mode to set') fan_parser = parser.add_subparser('action', 'fan', 'Turn the fan on or off') fan_parser.add_argument('state', choices=('on', 'off'), help='The fan state to change to') fan_parser.add_argument('--duration', '-d', type=int, default=1800, help='Time (in seconds) for the fan to run (ignored if setting state to off)') show_parser = parser.add_subparser('action', 'show', 'Show information') show_parser.add_argument('item', choices=SHOW_ITEMS, help='The information to show') show_parser.add_argument('buckets', nargs='*', help='The buckets to show (only applies to item=buckets)') show_parser.add_argument('--format', '-f', choices=Printer.formats, help='Output format') show_parser.add_argument('--unit', '-u', default='f', choices=('f', 'c'), help='Unit (Celsius or Fahrenheit) for functions that support it') show_parser.add_argument('--raw', '-r', action='store_true', help='Show the full raw response instead of the processed response (only applies to item=buckets)') with parser.add_subparser('action', 'schedule', 'Update the schedule') as schd_parser: schd_add = schd_parser.add_subparser('sub_action', 'add', 'Add entries with the specified schedule') schd_add.add_argument('cron', help='Cron-format schedule to use') schd_add.add_argument('temp', type=float, help='The temperature to set at the specified time') schd_add.add_argument('unit', nargs='?', default='f', choices=('f', 'c'), help='Unit (Celsius or Fahrenheit)') schd_rem = schd_parser.add_subparser('sub_action', 'remove', 'Remove entries with the specified schedule') schd_rem.add_argument('cron', help='Cron-format schedule to use') schd_rem.add_constant('temp', None) schd_rem.add_constant('unit', None) schd_save = schd_parser.add_subparser('sub_action', 'save', 'Save the current schedule to a file') schd_save.add_argument('path', help='The path to a file in which the current schedule should be saved') schd_save.add_argument('--overwrite', '-W', action='store_true', help='Overwrite the file if it already exists') schd_save.add_argument('--unit', '-u', default='f', choices=('f', 'c'), help='Unit (Celsius or Fahrenheit)') schd_load = schd_parser.add_subparser('sub_action', 'load', 'Load a schedule from a file') schd_load.add_argument('path', help='The path to a file containing the schedule that should be loaded') schd_show = schd_parser.add_subparser('sub_action', 'show', 'Show the current schedule') schd_show.add_argument('--format', '-f', choices=Printer.formats, help='Output format') schd_show.add_argument('--unit', '-u', default='f', choices=('f', 'c'), help='Unit (Celsius or Fahrenheit)') schd_parser.add_common_arg('--dry_run', '-D', action='store_true', help='Print actions that would be taken instead of taking them') full_status_parser = parser.add_subparser('action', 'full_status', 'Show/save the full device+shared status') full_status_parser.add_argument('--path', '-p', help='Location to store status info') full_status_parser.add_argument('--diff', '-d', action='store_true', help='Print a diff of the current status compared to the previous most recent status') parser.add_common_arg('--config', '-c', metavar='PATH', default='~/.config/nest.cfg', help='Config file location') parser.add_common_arg('--reauth', '-A', action='store_true', help='Force re-authentication, even if a cached session exists') parser.include_common_args('verbosity') return parser