Skip to content
Snippets Groups Projects
Commit cadc1cf7 authored by ale's avatar ale
Browse files

Better help messages

parent d8a0b045
Branches
No related tags found
1 merge request!1Modular
...@@ -12,6 +12,10 @@ from .rebuild import rebuild_deps ...@@ -12,6 +12,10 @@ from .rebuild import rebuild_deps
from .server import run_app from .server import run_app
def _fmtdesc(s):
return s.strip()
def main(): def main():
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description='Rebuild Docker images on a Gitlab instance.') description='Rebuild Docker images on a Gitlab instance.')
...@@ -47,8 +51,22 @@ def main(): ...@@ -47,8 +51,22 @@ def main():
'list-projects', 'list-projects',
parents=[common_parser], parents=[common_parser],
help='list projects', help='list projects',
description='List all projects and their branches on the Gitlab ' formatter_class=argparse.RawDescriptionHelpFormatter,
'instance.') description=_fmtdesc('''
List all projects and their branches on the Gitlab instance.
The output is a list of project paths with all their branches, separated
by a colon, one per line. Since the Gitlab 'search' API is quite
coarse, you can then filter the output for specific projects or branches
using 'grep', e.g.:
gitlab-deps list-projects | grep ^path/to/my/group/
or
gitlab-deps list-projects | grep ':master$'
'''))
list_projects_parser.add_argument( list_projects_parser.add_argument(
'--search', '--search',
help='Search query used to filter project list on the server side') help='Search query used to filter project list on the server side')
...@@ -58,11 +76,25 @@ def main(): ...@@ -58,11 +76,25 @@ def main():
'deps', 'deps',
parents=[common_parser], parents=[common_parser],
help='build dependency map', help='build dependency map',
description='Generate a map of dependencies between projects on a ' formatter_class=argparse.RawDescriptionHelpFormatter,
'Gitlab instance.') description=_fmtdesc('''
deps_parser.add_argument( Generate a map of dependencies between projects on a
'--docker', action='store_true', Gitlab instance.
help='Output dependencies between Docker images, not Gitlab projects')
The input (on standard input) must consist of a list of projects along
with their branches, separated by a colon, one per line. If the branch
is unspecified, 'master' is assumed.
The output consists of pairs of project / dependency (so, these are
'forward' dependencies), for all projects/branches specified in the
input.
To obtain a list of reverse dependencies, one can simply swap the
columns in the output, e.g.:
gitlab-deps deps < project.list | awk '{print $2, $1}'
'''))
# Setup pipeline hooks on the specified projects. # Setup pipeline hooks on the specified projects.
set_hooks_parser = subparsers.add_parser( set_hooks_parser = subparsers.add_parser(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment