Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
# Conflicts:
#	pyproject.toml
  • Loading branch information
Alwinator committed Mar 8, 2022
2 parents 8b99883 + 140f13a commit d7c488a
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
21 changes: 19 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ graphviz-py -Tpng example/example.py.dot -o output.png
### Using stdin / pipes
[comment]: <> (echo 'digraph { node [fontname="Arial"]; edge [fontname="Arial"]; A -> B [label=" {{= 38 * 73 }}"] }' | graphviz-py -Tsvg > output.svg)
```bash
echo 'digraph { A -> B [label=" {{= 38 * 73 }}"] }' | graphviz-py -Tsvg > output.svg
echo 'digraph { A -> B [label="{{= 38 * 73 }}"] }' | graphviz-py -Tsvg > output.svg
```
graphviz-py passes all unknown arguments to graphviz. So you can use all [graphviz arguments](https://graphviz.org/doc/info/command.html).

Expand All @@ -68,4 +68,21 @@ Here we pass a variable called "myvalue" with the value 5
Please keep in mind that graphviz-py executes all Python code in the diagram. So make sure that your diagrams dies not include harmful code.

## Coming soon
- Compartibility with asciidoctor-diagram
- Compartibility with asciidoctor-diagram ([Status: Implemented & Approved, waiting for merging](https://github.com/asciidoctor/asciidoctor-diagram/pull/379))

## Arguments
```bash
# graphviz-py --help
usage: graphviz-py [-h] [-v] [-d] [-a ARGUMENT] [files [files ...]]

graphviz-py diagram builder

positional arguments:
files the paths to the graphviz-py files

optional arguments:
-h, --help show this help message and exit
-v, --version show program's version number and exit
-d, --debug show debug information
-a ARGUMENT, --argument ARGUMENT
```
7 changes: 6 additions & 1 deletion graphviz_py/cli.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import sys
import argparse
import logging
from pathlib import Path

from graphviz_py.graphviz import execute_graphviz
Expand All @@ -8,15 +9,19 @@

parser = argparse.ArgumentParser(description='graphviz-py diagram builder')
parser.add_argument('-v', '--version', action='version', version=f'{Project.name()} version: {Project.version()}')
parser.add_argument('-d', '--debug', action='store_true', help='show debug information')
parser.add_argument('-a', '--argument', action='append')
parser.add_argument('files', type=Path, nargs=argparse.ZERO_OR_MORE, help='an integer for the accumulator')
parser.add_argument('files', type=Path, nargs=argparse.ZERO_OR_MORE, help='the paths to the graphviz-py files')

args, unknown = parser.parse_known_args()


def main(_=None):
"""Process command line arguments."""

if args.debug:
logging.getLogger().setLevel(logging.DEBUG)

file_contents = []
arguments = []

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ readme = "README.md"
keywords = ["graphviz", "dot", "python", "graphviz-python", "gv"]

[tool.poetry.dependencies]
python = ">=3.7.0"
python = ">=3.8.0"

[tool.poetry.scripts]
graphviz-py = "graphviz_py.cli:main"
Expand Down

0 comments on commit d7c488a

Please sign in to comment.