From b477d41aaa0364aff4b3ac38f77e57198ec2650d Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Fri, 3 May 2024 14:59:22 -0400 Subject: [PATCH] Slight tune up to formatting of examples etc to harmonize appearance/make shorter Original --help is too long and a little more inconsistent -- the "#" are shell script construct and generally not used to demarkate anything there, so kind no point to have/look odd --- dandi/cli/cmd_download.py | 37 +++++++++++++++++++------------------ dandi/dandiarchive.py | 16 ++++++++-------- 2 files changed, 27 insertions(+), 26 deletions(-) diff --git a/dandi/cli/cmd_download.py b/dandi/cli/cmd_download.py index 647d21951..7a9ebeff7 100644 --- a/dandi/cli/cmd_download.py +++ b/dandi/cli/cmd_download.py @@ -12,24 +12,26 @@ from ..utils import get_instance, joinurl _examples = """ -EXAMPLES:\n -# Download only the dandiset.yaml\n -dandi download --download dandiset.yaml DANDI:000027\n +EXAMPLES: -# Download only dandiset.yaml if there is a newer version\n -dandi download https://identifiers.org/DANDI:000027 --existing refresh - -# Download only the assets\n -dandi download --download assets DANDI:000027 - -# Download all from a specific version\n -dandi download DANDI:000027/0.210831.2033 - -# Download a specific directory\n -dandi download dandi://DANDI/000027@0.210831.2033/sub-RAT123/ - -# Download a specific file\n -dandi download dandi://DANDI/000027@0.210831.2033/sub-RAT123/sub-RAT123.nwb +\b + - Download only the dandiset.yaml + dandi download --download dandiset.yaml DANDI:000027 +\b + - Download only dandiset.yaml if there is a newer version + dandi download https://identifiers.org/DANDI:000027 --existing refresh +\b + - Download only the assets + dandi download --download assets DANDI:000027 +\b + - Download all from a specific version + dandi download DANDI:000027/0.210831.2033 +\b + - Download a specific directory + dandi download dandi://DANDI/000027@0.210831.2033/sub-RAT123/ +\b + - Download a specific file + dandi download dandi://DANDI/000027@0.210831.2033/sub-RAT123/sub-RAT123.nwb """ @@ -45,7 +47,6 @@ \b {_dandi_url_parser.known_patterns} -\b {_examples} """ diff --git a/dandi/dandiarchive.py b/dandi/dandiarchive.py index b931ce871..9c0efd23a 100644 --- a/dandi/dandiarchive.py +++ b/dandi/dandiarchive.py @@ -676,14 +676,14 @@ class _dandi_url_parser: ), ] resource_identifier_primer = """RESOURCE ID/URLS:\n - dandi commands accept URLs and URL-like identifiers called in the following formats for identifying Dandisets, assets, and - asset collections. - - Text in [brackets] is optional. A server field is a base API or GUI URL - 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. + dandi commands accept URLs and URL-like identifiers called in the following formats for identifying Dandisets, assets, and + asset collections. + + Text in [brackets] is optional. A server field is a base API or GUI URL + 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]