diff --git a/bin/get_formulas.py b/bin/get_formulas.py index 9139d4a..0ef41ff 100755 --- a/bin/get_formulas.py +++ b/bin/get_formulas.py @@ -84,29 +84,33 @@ with open('FORMULAS.yaml', 'r') as f: FORMULAS = yaml.load(f) parser = argparse.ArgumentParser(description='Loads the formulas from FORMULAS.yaml and optionally clones them in a specified destination. Optionally it can also create a symlink from the cloned path to /srv/salt, useful for the CI worker. The internal gitlab fork will also be added as secondary remote.') +parser.add_argument('-d', '--destination', nargs=1, help='Destination absolute path of the cloned (or to-be-cloned) repositories of the formulas.') parser.add_argument('-c', '--clone', action='store_true', help='Clone the formulas to the destination specified with "--destination". The gitlab fork will also be added as remote. If the repository is already cloned, then both remotes will be pulled/fetched.') parser.add_argument('-s', '--symlink', action='store_true', help='Creates symlink from the specified destination to /srv/salt.') parser.add_argument('-r', '--remote', nargs=1, help='Enable the specified remote. Available remotes: origin, opensuse. Default: origin') parser.add_argument('-p', '--pull-requests', action='store_true', help='Prints the status of the Pull Requests that are defined in FORMULAS.yaml under "pending".') -requiredArgs = parser.add_argument_group('required arguments') -requiredArgs.add_argument('-d', '--destination', nargs=1, required=True, help='Destination absolute path of the cloned (or to-be-cloned) repositories of the formulas.') args = parser.parse_args() -if not os.path.isabs(args.destination[0]): - parser.print_help() - sys.exit(1) - -if args.remote and args.remote[0] not in ['origin', 'opensuse']: +if args.destination and not os.path.isabs(args.destination[0]): parser.print_help() sys.exit(1) if args.clone: + if not args.destination: + parser.print_help() + sys.exit(1) clone_or_pull(args.destination[0]) if args.symlink: + if not args.destination: + parser.print_help() + sys.exit(1) create_symlinks(args.destination[0]) if args.remote: + if args.remote[0] not in ['origin', 'opensuse'] or not args.destination: + parser.print_help() + sys.exit(1) enable_remote(args.remote[0], args.destination[0]) if args.pull_requests: