diff --git a/dandi/dandiarchive.py b/dandi/dandiarchive.py index 40eb5fb3f..eefb99af5 100644 --- a/dandi/dandiarchive.py +++ b/dandi/dandiarchive.py @@ -704,7 +704,7 @@ class _dandi_url_parser: for a DANDI Archive instance. If an optional ``version`` field is omitted from a URL, the given Dandiset's most recent published version will be used if it has one, and its draft version will be used otherwise. - """ +""" known_patterns = "Accepted resource identifier patterns:" + "\n - ".join( [""] + [display for _, _, display in known_urls] ) diff --git a/dandi/tests/test_helptext.py b/dandi/tests/test_helptext.py new file mode 100644 index 000000000..b72062112 --- /dev/null +++ b/dandi/tests/test_helptext.py @@ -0,0 +1,22 @@ +import subprocess + + +def get_helptext(command): + result = subprocess.run( + [*command, '--help'], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + text=True + ) + return result.stdout + + +def test_resource_identifier_helptext(): + # The \n chars must be included for correct rendering + correct = "Accepted resource identifier patterns:\n - DANDI:[/]\n" + + ls_helptext = get_helptext(['dandi', 'ls']) + assert correct in ls_helptext + + download_helptext = get_helptext(['dandi', 'download']) + assert correct in download_helptext