diff --git a/swh/model/cli.py b/swh/model/cli.py --- a/swh/model/cli.py +++ b/swh/model/cli.py @@ -169,6 +169,8 @@ \b https://docs.softwareheritage.org/devel/swh-model/persistent-identifiers.html + Tip: you can pass "-" to identify the content of standard input. + \b Examples: @@ -189,7 +191,7 @@ """ # NoQA # overlong lines in shell examples are fine if not objects: - objects = ["-"] + raise click.UsageError("no object given") if verify and len(objects) != 1: raise click.BadParameter("verification requires a single object") diff --git a/swh/model/tests/test_cli.py b/swh/model/tests/test_cli.py --- a/swh/model/tests/test_cli.py +++ b/swh/model/tests/test_cli.py @@ -38,7 +38,7 @@ """identify file content""" self.make_contents(self.tmpdir_name) for _, content in self.contents.items(): - result = self.runner.invoke(cli.identify, input=content["data"]) + result = self.runner.invoke(cli.identify, ["-"], input=content["data"]) self.assertPidOK(result, "swh:1:cnt:" + hash_to_hex(content["sha1_git"])) def test_directory_id(self):