Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9341743
D1476.id4837.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
D1476.id4837.diff
View Options
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
Details
Attached
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
Attached To
D1476: add an example cli subcommand
Event Timeline
Log In to Comment