예제 #1
0
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)
예제 #2
0
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)
예제 #3
0
 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()
예제 #4
0
 def test_list_resources(self):
     """Test resources.list_resources."""
     self.assertEqual(list_resources(), resource_names)
예제 #5
0
def test_list_resources():
    """Test resources.list_resources."""
    result = '\n'.join(list_resources())
    for item in resource_names:
        assert item in result