def main(parser, opts, resource=None, tgt_dir=None): if cylc.flow.flags.verbosity < 2: disable_timestamps(LOG) if not resource or opts.list: list_resources() sys.exit(0) get_resources(resource, tgt_dir)
def main(parser, opts, *args): if opts.list: print('\n'.join(list_resources())) sys.exit(0) elif not args: print(parser.usage) sys.exit(0) target_dir, *resources = args extract_resources(target_dir, resources or None)
def parse_args(): if {'help', '--help', "-h"} & set(sys.argv): print(__doc__) elif len(sys.argv) < 2: raise UserInputError( "wrong number of arguments, " f"see '{os.path.basename(sys.argv[0])} --help'.") elif '--list' in sys.argv: print('\n'.join(list_resources())) else: return (None, sys.argv[1:]) sys.exit()
def test_list_resources(self): """Test resources.list_resources.""" self.assertEqual(list_resources(), resource_names)
def test_list_resources(): """Test resources.list_resources.""" result = '\n'.join(list_resources()) for item in resource_names: assert item in result