Skip to content

Commit

Permalink
Add debug mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Alwinator committed Mar 8, 2022
1 parent 594a030 commit 140f13a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,20 @@ Please keep in mind that graphviz-py executes all Python code in the diagram. So

## Coming soon
- 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
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "graphviz-py"
version = "1.0.3"
version = "1.0.4"
description = "Allows Python code execution inside of graphviz diagrams."
authors = ["Alwin Schuster <[email protected]>"]
license = 'MPL-2.0'
Expand All @@ -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 140f13a

Please sign in to comment.