- commit
- 67fff92c847a561171b4d87cafb45470eec8f521
- parent
- d9f1c58b85163704fdd700acb743b5d615b70568
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2022-08-26 17:24
make formatting optional
Diffstat
| M | xipd/__main__.py | 4 | ++-- |
| M | xipd/format.py | 11 | +++++++++++ |
2 files changed, 13 insertions, 2 deletions
diff --git a/xipd/__main__.py b/xipd/__main__.py
@@ -2,7 +2,7 @@ import sys 2 2 import argparse 3 3 4 4 from .renderer import Renderer5 -1 from .format import autoformat-1 5 from .format import try_autoformat 6 6 7 7 8 8 def main(): @@ -14,7 +14,7 @@ def main(): 14 14 15 15 renderer = Renderer() 16 16 output = renderer.render(args.infile)17 -1 output = autoformat(output)-1 17 output = try_autoformat(output) 18 18 print(output, end='') 19 19 20 20
diff --git a/xipd/format.py b/xipd/format.py
@@ -60,6 +60,17 @@ def autoformat(pd): 60 60 return apply_positions(pd, positions) 61 61 62 62 -1 63 def try_autoformat(pd): -1 64 try: -1 65 return autoformat(pd) -1 66 except FileNotFoundError: -1 67 print( -1 68 f'WARNING: {DOT_CMD} could not be found. Formatting is disabled.', -1 69 file=sys.stderr, -1 70 ) -1 71 return pd -1 72 -1 73 63 74 def main(): 64 75 parser = argparse.ArgumentParser() 65 76 parser.add_argument(