diff --git a/README.rst b/README.rst index b733c64..64063bd 100644 --- a/README.rst +++ b/README.rst @@ -25,7 +25,7 @@ Script to create citation file formatted file (https://citation-file-format.gith Current supported DOI types: -* Zenodo software from a GitHub release (https://guides.github.com/activities/citable-code/) +* Zenodo upload from a GitHub release (https://guides.github.com/activities/citable-code/) Free software: Apache Software License 2.0 diff --git a/doi2cff/cli.py b/doi2cff/cli.py index 654d924..cd4ac34 100644 --- a/doi2cff/cli.py +++ b/doi2cff/cli.py @@ -19,7 +19,7 @@ def main(): Current supported DOI types: - * Zenodo software from a GitHub release (https://guides.github.com/activities/citable-code/) + * Zenodo upload of a GitHub release (https://guides.github.com/activities/citable-code/) """ pass @@ -39,7 +39,7 @@ def is_software_zenodo(zenodo_record): def init(doi, cff_fn): """Generate CITATION.cff file based on a Zenodo DOI of a Github release. - * DOI, The Zenodo DOI url of a GitHub release + * DOI, The Digital Object Identifier (DOI) name of a Zenodo upload of a GitHub release """ template = '''# YAML 1.2 # Metadata for citation of this software according to the CFF format (https://citation-file-format.github.io/) @@ -57,12 +57,12 @@ def init(doi, cff_fn): ''' if not doi_is_from_zenodo(doi): - raise NotImplemented('Unable to process doi, converter not implemented') + raise click.UsageError('Unable to process DOI name, only accept DOI name which is a Zenodo upload') zenodo_record = fetch_zenodo_by_doiurl(doi) if not is_software_zenodo(zenodo_record): - raise NotImplemented('Unable to process doi, converter not implemented for Zenodo entries other than software') + raise click.UsageError('Unable to process DOI name, only accept DOI name which is a Zenodo upload of type software') yaml = ruamel.yaml.YAML() data = yaml.load(template) @@ -101,7 +101,7 @@ def init(doi, cff_fn): def update(doi, cff_fn): """Update CITATION.cff with doi, version and release date of a new release - * DOI, The Zenodo DOI url of a GitHub release + * DOI, The Digital Object Identifier (DOI) name of a Zenodo upload of a GitHub release """ update_version(doi, cff_fn) @@ -129,9 +129,9 @@ def tagurl_of_zenodo(record): if related_identifier['relation'] == 'isSupplementTo': return related_identifier['identifier'] - msg = 'Unable to process DOI, Zenodo record does not contain a related identifier ' \ + msg = 'Unable to process DOI name, Zenodo upload does not contain a related identifier ' \ 'with isSupplementTo relation, which is expected for DOI generated by GitHub' - raise KeyError(msg) + raise click.UsageError(msg) def tagurl2repo(tagurl): @@ -228,7 +228,7 @@ def authors_of_csl(record): 'family-names': name.last, } else: - raise NotImplemented('Do not understand author field: {}'.format(a)) + raise click.UsageError('Unable to process DOI name, do not understand author field: {}'.format(a)) authors.append(author) return authors