From 1689cf1d37bd5edca082b60eca522aac7bb6a918 Mon Sep 17 00:00:00 2001 From: Kenji Brameld Date: Tue, 7 Jun 2022 15:40:57 +0900 Subject: [PATCH 1/4] add argument parser information Signed-off-by: Kenji Brameld --- bloom/commands/generate.py | 9 ++++++--- docs/conf.py | 5 +++-- docs/index.rst | 6 ++++++ docs/requirements.txt | 1 + docs/scripts.rst | 17 +++++++++++++++++ docs/scripts/bloom-export-upstream.rst | 6 ++++++ docs/scripts/bloom-generate.rst | 6 ++++++ docs/scripts/bloom-release.rst | 6 ++++++ docs/scripts/bloom-update.rst | 6 ++++++ docs/scripts/git-bloom-branch.rst | 6 ++++++ docs/scripts/git-bloom-config.rst | 6 ++++++ docs/scripts/git-bloom-generate.rst | 6 ++++++ docs/scripts/git-bloom-import-upstream.rst | 6 ++++++ docs/scripts/git-bloom-patch.rst | 6 ++++++ docs/scripts/git-bloom-rebase.rst | 2 ++ 15 files changed, 89 insertions(+), 5 deletions(-) create mode 100644 docs/requirements.txt create mode 100644 docs/scripts.rst create mode 100644 docs/scripts/bloom-export-upstream.rst create mode 100644 docs/scripts/bloom-generate.rst create mode 100644 docs/scripts/bloom-release.rst create mode 100644 docs/scripts/bloom-update.rst create mode 100644 docs/scripts/git-bloom-branch.rst create mode 100644 docs/scripts/git-bloom-config.rst create mode 100644 docs/scripts/git-bloom-generate.rst create mode 100644 docs/scripts/git-bloom-import-upstream.rst create mode 100644 docs/scripts/git-bloom-patch.rst create mode 100644 docs/scripts/git-bloom-rebase.rst diff --git a/bloom/commands/generate.py b/bloom/commands/generate.py index 166caaa8..eec18e8a 100644 --- a/bloom/commands/generate.py +++ b/bloom/commands/generate.py @@ -71,12 +71,15 @@ def create_subparsers(parser, generator_cmds): cmd_parser.set_defaults(func=desc['main']) add_global_arguments(cmd_parser) - -def main(sysargs=None): - parser = argparse.ArgumentParser( +def get_argument_parser(): + return argparse.ArgumentParser( description="Calls a generator on a local package, e.g. bloom-generate debian" ) + +def main(sysargs=None): + parser = get_argument_parser() + generator_cmds = list_generator_commands() create_subparsers(parser, generator_cmds) diff --git a/docs/conf.py b/docs/conf.py index b2f4ff45..9abd8f83 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -19,7 +19,7 @@ # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. -#sys.path.insert(0, os.path.abspath('.')) +sys.path.insert(0, os.path.abspath('..')) # -- General configuration ------------------------------------------------ @@ -35,6 +35,7 @@ 'sphinx.ext.todo', 'sphinx.ext.coverage', 'sphinx.ext.viewcode', + 'sphinxarg.ext', ] # Add any paths that contain templates here, relative to this directory. @@ -146,7 +147,7 @@ # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] +#html_static_path = [] # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied diff --git a/docs/index.rst b/docs/index.rst index d341e823..84e3b821 100755 --- a/docs/index.rst +++ b/docs/index.rst @@ -49,3 +49,9 @@ How do I release something with bloom? --------------------------------------- Please refer to the documentation and tutorials on the bloom_ ROS wiki page. + +.. toctree:: + :hidden: + :maxdepth: 2 + + scripts \ No newline at end of file diff --git a/docs/requirements.txt b/docs/requirements.txt new file mode 100644 index 00000000..1e76fdad --- /dev/null +++ b/docs/requirements.txt @@ -0,0 +1 @@ +sphinx-argparse \ No newline at end of file diff --git a/docs/scripts.rst b/docs/scripts.rst new file mode 100644 index 00000000..dc7ceca4 --- /dev/null +++ b/docs/scripts.rst @@ -0,0 +1,17 @@ +Scripts +======= + +.. toctree:: + :hidden: + :maxdepth: 2 + + scripts/bloom-export-upstream + scripts/bloom-generate + scripts/bloom-release + scripts/bloom-update + scripts/git-bloom-branch + scripts/git-bloom-config + scripts/git-bloom-generate + scripts/git-bloom-import-upstream + scripts/git-bloom-patch + scripts/git-bloom-rebase diff --git a/docs/scripts/bloom-export-upstream.rst b/docs/scripts/bloom-export-upstream.rst new file mode 100644 index 00000000..17558332 --- /dev/null +++ b/docs/scripts/bloom-export-upstream.rst @@ -0,0 +1,6 @@ +bloom-export-upstream +===================== + +.. argparse:: + :ref: bloom.commands.export_upstream.get_argument_parser + :prog: bloom-export-upstream diff --git a/docs/scripts/bloom-generate.rst b/docs/scripts/bloom-generate.rst new file mode 100644 index 00000000..1427aa47 --- /dev/null +++ b/docs/scripts/bloom-generate.rst @@ -0,0 +1,6 @@ +bloom-generate +============== + +.. argparse:: + :ref: bloom.commands.generate.get_argument_parser + :prog: bloom-generate diff --git a/docs/scripts/bloom-release.rst b/docs/scripts/bloom-release.rst new file mode 100644 index 00000000..5275ee8c --- /dev/null +++ b/docs/scripts/bloom-release.rst @@ -0,0 +1,6 @@ +bloom-release +============= + +.. argparse:: + :ref: bloom.commands.release.get_argument_parser + :prog: bloom-release diff --git a/docs/scripts/bloom-update.rst b/docs/scripts/bloom-update.rst new file mode 100644 index 00000000..64edf70c --- /dev/null +++ b/docs/scripts/bloom-update.rst @@ -0,0 +1,6 @@ +bloom-update +============ + +.. argparse:: + :ref: bloom.commands.update.get_argument_parser + :prog: bloom-update diff --git a/docs/scripts/git-bloom-branch.rst b/docs/scripts/git-bloom-branch.rst new file mode 100644 index 00000000..71f02744 --- /dev/null +++ b/docs/scripts/git-bloom-branch.rst @@ -0,0 +1,6 @@ +git-bloom-branch +================ + +.. argparse:: + :ref: bloom.commands.git.branch.get_parser + :prog: git-bloom-branch diff --git a/docs/scripts/git-bloom-config.rst b/docs/scripts/git-bloom-config.rst new file mode 100644 index 00000000..dd328595 --- /dev/null +++ b/docs/scripts/git-bloom-config.rst @@ -0,0 +1,6 @@ +git-bloom-config +================ + +.. argparse:: + :ref: bloom.commands.git.config.get_argument_parser + :prog: git-bloom-config \ No newline at end of file diff --git a/docs/scripts/git-bloom-generate.rst b/docs/scripts/git-bloom-generate.rst new file mode 100644 index 00000000..5cd58a1f --- /dev/null +++ b/docs/scripts/git-bloom-generate.rst @@ -0,0 +1,6 @@ +git-bloom-generate +================== + +.. argparse:: + :ref: bloom.commands.git.generate.get_parser + :prog: git-bloom-generate diff --git a/docs/scripts/git-bloom-import-upstream.rst b/docs/scripts/git-bloom-import-upstream.rst new file mode 100644 index 00000000..8af81d95 --- /dev/null +++ b/docs/scripts/git-bloom-import-upstream.rst @@ -0,0 +1,6 @@ +git-bloom-import-upstream +========================= + +.. argparse:: + :ref: bloom.commands.git.import_upstream.get_argument_parser + :prog: git-bloom-import-upstream diff --git a/docs/scripts/git-bloom-patch.rst b/docs/scripts/git-bloom-patch.rst new file mode 100644 index 00000000..3239c2cd --- /dev/null +++ b/docs/scripts/git-bloom-patch.rst @@ -0,0 +1,6 @@ +git-bloom-patch +=============== + +.. argparse:: + :ref: bloom.commands.git.patch.patch_main.get_argument_parser + :prog: git-bloom-patch \ No newline at end of file diff --git a/docs/scripts/git-bloom-rebase.rst b/docs/scripts/git-bloom-rebase.rst new file mode 100644 index 00000000..123b6564 --- /dev/null +++ b/docs/scripts/git-bloom-rebase.rst @@ -0,0 +1,2 @@ +git-bloom-rebase +================ From 1075a90fc48bb900434c6223152f4c2eb152b3f1 Mon Sep 17 00:00:00 2001 From: Kenji Brameld Date: Tue, 7 Jun 2022 16:42:09 +0900 Subject: [PATCH 2/4] remove scripts.rst Signed-off-by: Kenji Brameld --- docs/index.rst | 11 ++++++++++- docs/scripts.rst | 17 ----------------- 2 files changed, 10 insertions(+), 18 deletions(-) delete mode 100644 docs/scripts.rst diff --git a/docs/index.rst b/docs/index.rst index 84e3b821..086ea7d9 100755 --- a/docs/index.rst +++ b/docs/index.rst @@ -54,4 +54,13 @@ Please refer to the documentation and tutorials on the bloom_ ROS wiki page. :hidden: :maxdepth: 2 - scripts \ No newline at end of file + scripts/bloom-export-upstream + scripts/bloom-generate + scripts/bloom-release + scripts/bloom-update + scripts/git-bloom-branch + scripts/git-bloom-config + scripts/git-bloom-generate + scripts/git-bloom-import-upstream + scripts/git-bloom-patch + scripts/git-bloom-rebase diff --git a/docs/scripts.rst b/docs/scripts.rst deleted file mode 100644 index dc7ceca4..00000000 --- a/docs/scripts.rst +++ /dev/null @@ -1,17 +0,0 @@ -Scripts -======= - -.. toctree:: - :hidden: - :maxdepth: 2 - - scripts/bloom-export-upstream - scripts/bloom-generate - scripts/bloom-release - scripts/bloom-update - scripts/git-bloom-branch - scripts/git-bloom-config - scripts/git-bloom-generate - scripts/git-bloom-import-upstream - scripts/git-bloom-patch - scripts/git-bloom-rebase From ffd03551bb2f510cea16bf2f2a56d8c1516bddcc Mon Sep 17 00:00:00 2001 From: Kenji Brameld Date: Tue, 7 Jun 2022 16:52:29 +0900 Subject: [PATCH 3/4] fix E302 expected 2 blank lines, found 1 Signed-off-by: Kenji Brameld --- bloom/commands/generate.py | 1 + 1 file changed, 1 insertion(+) diff --git a/bloom/commands/generate.py b/bloom/commands/generate.py index eec18e8a..b8931905 100644 --- a/bloom/commands/generate.py +++ b/bloom/commands/generate.py @@ -71,6 +71,7 @@ def create_subparsers(parser, generator_cmds): cmd_parser.set_defaults(func=desc['main']) add_global_arguments(cmd_parser) + def get_argument_parser(): return argparse.ArgumentParser( description="Calls a generator on a local package, e.g. bloom-generate debian" From 84e972c174acb36c52df02fd1859135e1ca9fa22 Mon Sep 17 00:00:00 2001 From: Kenji Brameld Date: Tue, 7 Jun 2022 20:42:22 +0900 Subject: [PATCH 4/4] simplify toctree Signed-off-by: Kenji Brameld --- docs/index.rst | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/docs/index.rst b/docs/index.rst index 086ea7d9..df93bbba 100755 --- a/docs/index.rst +++ b/docs/index.rst @@ -51,16 +51,9 @@ How do I release something with bloom? Please refer to the documentation and tutorials on the bloom_ ROS wiki page. .. toctree:: + :caption: Command Details + :glob: :hidden: :maxdepth: 2 - scripts/bloom-export-upstream - scripts/bloom-generate - scripts/bloom-release - scripts/bloom-update - scripts/git-bloom-branch - scripts/git-bloom-config - scripts/git-bloom-generate - scripts/git-bloom-import-upstream - scripts/git-bloom-patch - scripts/git-bloom-rebase + scripts/*