diff --git a/api/client/requirements.txt b/api/client/requirements.txt index 39a323a..e48369d 100644 --- a/api/client/requirements.txt +++ b/api/client/requirements.txt @@ -1 +1,2 @@ +click vcversioner diff --git a/api/client/swh/graph/cli.py b/api/client/swh/graph/cli.py new file mode 100644 index 0000000..465cd1d --- /dev/null +++ b/api/client/swh/graph/cli.py @@ -0,0 +1,28 @@ +import click + +import client + + +CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help']) + + +@click.command(context_settings=CONTEXT_SETTINGS) +@click.option('--host', default='0.0.0.0', help="Host where runs the server") +@click.option('--port', default='5010', help="Binding port of the server") +@click.pass_context +def cli(ctx, host, port): + """Software Heritage Graph API + + """ + url = 'http://' + host + ':' + port + app = client.RemoteGraphClient(url) + + print(app.get_nb_nodes()) + + +def main(): + return cli(auto_envvar_prefix='SWH_GRAPH') + + +if __name__ == '__main__': + main()