Page MenuHomeSoftware Heritage

D1476.id4837.diff
No OneTemporary

D1476.id4837.diff

diff --git a/requirements-swh.txt b/requirements-swh.txt
--- a/requirements-swh.txt
+++ b/requirements-swh.txt
@@ -1 +1,2 @@
# Add here internal Software Heritage dependencies, one per line.
+swh.core
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -53,11 +53,10 @@
extras_require={'testing': parse_requirements('test')},
vcversioner={},
include_package_data=True,
- entry_points={
- 'console_scripts': [ # cli tools provided by this package, eg.
- # 'swh-my-command=swh.<module-name>.cli:main',
- ]
- },
+ entry_points='''
+ [swh.cli.subcommands]
+ <cli-name>=swh.<module>.cli:cli
+ ''',
classifiers=[
"Programming Language :: Python :: 3",
"Intended Audience :: Developers",
diff --git a/swh/foo/cli.py b/swh/foo/cli.py
new file mode 100644
--- /dev/null
+++ b/swh/foo/cli.py
@@ -0,0 +1,18 @@
+import click
+
+from swh.core.cli import CONTEXT_SETTINGS
+
+
+@click.group(name='foo', context_settings=CONTEXT_SETTINGS)
+@click.pass_context
+def cli(ctx):
+ """Foo main command.
+ """
+
+
+@cli.command()
+@click.option('--bar', help='Something')
+@click.pass_context
+def bar(ctx, bar):
+ '''Do something.'''
+ click.echo('bar')

File Metadata

Mime Type
text/plain
Expires
Thu, Jul 3, 12:17 PM (2 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3216866

Event Timeline