-
Notifications
You must be signed in to change notification settings - Fork 14
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
New command-line interface (options) #181
Open
zvr
wants to merge
1
commit into
spdx:main
Choose a base branch
from
zvr:cmdline
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
@@ -1,65 +1,102 @@ | ||||||||||
# spec-parser | ||||||||||
|
||||||||||
Automagically process the model of the SPDXv3 specification to validate input | ||||||||||
or to generate stuff. | ||||||||||
and/or generate stuff. | ||||||||||
|
||||||||||
## Usage | ||||||||||
## Functionality | ||||||||||
|
||||||||||
```shell | ||||||||||
python3 ./main.py -h | ||||||||||
usage: main.py [-h] [-d] [-f] [-n] [-q] [-v] [-V] input_dir [output_dir] | ||||||||||
The software always reads and validates the complete model (given as input). | ||||||||||
|
||||||||||
It then optionally generates one or more of the following outputs: | ||||||||||
|
||||||||||
1. JSON dump of the parsed model, to load all data without parsing | ||||||||||
2. MkDocs files, to be used by mkdocs to generate a website | ||||||||||
3. PlantUML file, to be used by plantuml to generate a diagram | ||||||||||
4. RDF files (ontology and context), for any need | ||||||||||
5. TeX files, to be used by LaTeX to generate a printable version | ||||||||||
6. Web page files, to provide information on the RDF URIs | ||||||||||
|
||||||||||
If no generation is specified in the command line, | ||||||||||
the default functionality is to generate everything. | ||||||||||
|
||||||||||
## Usage | ||||||||||
|
||||||||||
Generate documentation from an SPDX 3.0 model | ||||||||||
``` | ||||||||||
usage: main.py [-h] [-V] [-d] [-v] [-f] [-n] | ||||||||||
[-o OUTPUT] | ||||||||||
[-j] [-J dir] | ||||||||||
[-m] [-M dir] | ||||||||||
[-p] [-P dir] | ||||||||||
[-r] [-R dir] | ||||||||||
[-t] [-T dir] | ||||||||||
[-w] [-W dir] | ||||||||||
input_dir | ||||||||||
|
||||||||||
Generate documentation from an SPDXv3 model. | ||||||||||
|
||||||||||
positional arguments: | ||||||||||
input_dir Directory containing the input specification files | ||||||||||
output_dir Directory to write the output files to | ||||||||||
input_dir Path to the input 'model' directory. | ||||||||||
|
||||||||||
options: | ||||||||||
-h, --help show this help message and exit | ||||||||||
-d, --debug Print debug output | ||||||||||
-f, --force Overwrite existing generated files | ||||||||||
-n, --nooutput Do not generate anything, only check input | ||||||||||
-q, --quiet Print no output | ||||||||||
-v, --verbose Print verbose output | ||||||||||
-V, --version show program's version number and exit | ||||||||||
``` | ||||||||||
-h, --help Show this help message and exit | ||||||||||
-d, --debug Print debug output | ||||||||||
-f, --force Force overwrite of existing output directories. | ||||||||||
-j, --generate-jsondump Generate a dump of the model in JSON format. | ||||||||||
-J, --output-jsondump OUTPUT_JSONDUMP Output directory for JSON dump file. | ||||||||||
-m, --generate-mkdocs Generate mkdocs output. | ||||||||||
-M, --output-mkdocs OUTPUT_MKDOCS Output directory for mkdocs files. | ||||||||||
Comment on lines
+46
to
+47
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Keep the original casing. Similar to PlantUML and TeX. |
||||||||||
-n, --no-output Perform no output generation, only input validation. | ||||||||||
-o, --output OUTPUT Single output directory for all output types. | ||||||||||
-p, --generate-plantuml Generate PlantUML output. | ||||||||||
-P, --output-plantuml OUTPUT_PLANTUML Output directory for PlantUML files. | ||||||||||
-r, --generate-rdf Generate RDF output. | ||||||||||
-R, --output-rdf OUTPUT_RDF Output directory for RDF files. | ||||||||||
-t, --generate-tex Generate TeX output. | ||||||||||
-T, --output-tex OUTPUT_TEX Output directory for TeX files. | ||||||||||
-v, --verbose Print verbose output | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Keep consistent with other descriptions that have a fullstop. |
||||||||||
-V, --version Show program version number and exit | ||||||||||
-w, --generate-webpages Generate web pages output. | ||||||||||
-W, --output-webpages OUTPUT_WEBPAGES Output directory for web pages. | ||||||||||
|
||||||||||
Note that not all flags are functional yet. | ||||||||||
``` | ||||||||||
|
||||||||||
### Checking input | ||||||||||
|
||||||||||
If no generation is needed and only input validation is required: | ||||||||||
|
||||||||||
```shell | ||||||||||
python3 main.py -n some/where/.../model | ||||||||||
``` | ||||||||||
|
||||||||||
Note that no dependencies are needed. | ||||||||||
|
||||||||||
### Generate output | ||||||||||
|
||||||||||
```shell | ||||||||||
python3 -m pip install -r requirements.txt | ||||||||||
python3 main.py some/where/.../model some/where/else/.../output_dir | ||||||||||
``` | ||||||||||
## Prerequisites | ||||||||||
|
||||||||||
## Current status (mostly complete / in progress) | ||||||||||
| **Action** | *Prerequisites* | | ||||||||||
|---|---| | ||||||||||
| input validation (`-n`/`--no-output`) | None | | ||||||||||
| JSON dump generation | [jsonpickle](https://pypi.org/project/jsonpickle/) Python module | | ||||||||||
| MkDocs generation | [Jinja2](https://pypi.org/project/Jinja2/) Python module | | ||||||||||
| PlantUML generation | None | | ||||||||||
| RDF generation | [RDFlib](https://pypi.org/project/rdflib/) Python module | | ||||||||||
| TeX generation | [Jinja2](https://pypi.org/project/Jinja2/) Python module and [pandoc](https://pandoc.org/) software | | ||||||||||
| Web pages generation | [Jinja2](https://pypi.org/project/Jinja2/) Python module | | ||||||||||
|
||||||||||
- [x] parse everything in model | ||||||||||
- [x] generate mkdocs input | ||||||||||
- [x] generate JSON dump | ||||||||||
- [x] generate diagrams | ||||||||||
- [x] generate RDF ontology | ||||||||||
- [x] generate JSON-LD context | ||||||||||
The software will check for the presence of prerequisites, | ||||||||||
according to the calling arguments, | ||||||||||
and exit if they are not present. | ||||||||||
|
||||||||||
## Contributing | ||||||||||
|
||||||||||
Contributions are always welcome! | ||||||||||
|
||||||||||
Feel free to open issues for any behavior that is (or even simply does not | ||||||||||
seem) correct. | ||||||||||
Feel free to open issues for any behavior that is not | ||||||||||
(or even simply does not seem) correct. | ||||||||||
|
||||||||||
However, due to the pressure for releasing SPDXv3, development is happening in | ||||||||||
fast mode, and not always refelcted in this repository. To save everyone | ||||||||||
valuable time, if you want to contribute code: clearly indicate in the | ||||||||||
corresponding issue your willingness to work on it, and _wait_ for the | ||||||||||
assignment of the issue to you. | ||||||||||
However, due to the pressure for releasing SPDXv3, | ||||||||||
development is happening in fast mode, | ||||||||||
and not always refelcted in this repository. | ||||||||||
To save everyone valuable time, if you want to contribute code: | ||||||||||
clearly indicate in the corresponding issue | ||||||||||
your willingness to work on it, | ||||||||||
and _wait_ for the assignment of the issue to you. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Keep consistent with other descriptions that have a fullstop.