-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[issue-388] Update CLI tools for the new parsers/writers #401
[issue-388] Update CLI tools for the new parsers/writers #401
Conversation
0f12d02
to
454b68f
Compare
48c4e72
to
5eb63e4
Compare
Signed-off-by: Armin Tänzer <armin.taenzer@tngtech.com>
Signed-off-by: Armin Tänzer <armin.taenzer@tngtech.com>
Signed-off-by: Armin Tänzer <armin.taenzer@tngtech.com>
Signed-off-by: Armin Tänzer <armin.taenzer@tngtech.com>
Signed-off-by: Armin Tänzer <armin.taenzer@tngtech.com>
454b68f
to
ca81a12
Compare
src/formats.py
Outdated
YAML = auto() | ||
XML = auto() | ||
TAG_VALUE = auto() | ||
RDF = auto() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RDF
or RDF_XML
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use these interchangeably, but RDF_XML
is more precise, I guess. Fixed.
src/clitools/parser.py
Outdated
if validate: | ||
validation_messages: List[ValidationMessage] = validate_full_spdx_document(document, version) | ||
if validation_messages: | ||
print("The document is invalid. The following issues have been found:") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If not valid, the cli should exit
with 1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parser and converter have been merged into a single tool.
src/clitools/parser.py
Outdated
print("Please note that this project is currently undergoing a major refactoring and therefore missing " | ||
"a few features which will be added in time.\n" | ||
"In the meanwhile, please use the current PyPI release version 0.7.0.") | ||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in case of error, it should also exit
with 1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parser and converter have been merged into a single tool.
src/clitools/parser.py
Outdated
document: Document = parse_file(file) | ||
except NotImplementedError as err: | ||
print(err.args[0]) | ||
print("Please note that this project is currently undergoing a major refactoring and therefore missing " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe link to the issues?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/clitools/convertor.py
Outdated
write_file(document, outfile) | ||
except NotImplementedError as err: | ||
print(err.args[0]) | ||
print("Please note that this project is currently undergoing a major refactoring and therefore missing " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also here: on error exit with code 1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/clitools/parser.py
Outdated
def main(file, force): | ||
@click.option("--version", prompt="SPDX version", help="The SPDX version to be used during validation") | ||
@click.option("--validate", is_flag=True, help="validate the provided document") | ||
@click.option("--printout", is_flag=True, help="print the parsed document to stdout in tag-value format") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a pure debug option?
An often seen convention, to print to stdout, is to use the argument -
. So -o -
implies output is stdout.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/clitools/parser.py
Outdated
@click.option("--version", prompt="SPDX version", help="The SPDX version to be used during validation") | ||
@click.option("--validate", is_flag=True, help="validate the provided document") | ||
@click.option("--printout", is_flag=True, help="print the parsed document to stdout in tag-value format") | ||
def main(file, version, validate, printout): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is there a parser and a converter? I think they both could be the same tool.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parser and converter have been merged into a single tool.
Signed-off-by: Armin Tänzer <armin.taenzer@tngtech.com>
…the README Signed-off-by: Armin Tänzer <armin.taenzer@tngtech.com>
fixes #388
parsing output uses the tag-value writer to output to stdout