Kaynağa Gözat

Merge dbab810dee into c2c24c69b8

pull/524/merge
Cedrik Neumann 2 hafta önce
committed by GitHub
ebeveyn
işleme
5ce772c6a8
Veri tabanında bu imza için bilinen anahtar bulunamadı GPG Anahtar Kimliği: B5690EEEBB952194
2 değiştirilmiş dosya ile 49 ekleme ve 0 silme
  1. +31
    -0
      diagrams/cli.py
  2. +18
    -0
      docs/getting-started/installation.md

+ 31
- 0
diagrams/cli.py Dosyayı Görüntüle

@@ -0,0 +1,31 @@
import argparse
import sys


def run() -> int:
parser = argparse.ArgumentParser(
description="Run diagrams code files in a diagrams environment.",
)
parser.add_argument(
"paths",
metavar="path",
type=str,
nargs="+",
help="a Python file containing diagrams code",
)
args = parser.parse_args()

for path in args.paths:
print(path)
with open(path) as f:
exec(f.read())

return 0


def main():
sys.exit(run())


if __name__ == "__main__":
main()

+ 18
- 0
docs/getting-started/installation.md Dosyayı Görüntüle

@@ -20,6 +20,9 @@ $ pipenv install diagrams

# using poetry
$ poetry add diagrams

# using pipx
$ pipx install diagrams
```

## Quick Start
@@ -47,6 +50,21 @@ This generates the diagram below:

It will be saved as `web_service.png` in your working directory.

### CLI

If the `diagrams` CLI has been installed system wide (i.e. with [pipx](https://pipxproject.github.io/pipx/)),
then the preceding command is equivalent to this.

```shell
$ diagrams diagram.py
```

Furthermore you can execute multiple files at once

```shell
$ diagrams diagram1.py diagram2.py
```

## Next

See more [Examples](/docs/getting-started/examples) or see the [Guides](/docs/guides/diagram) page for more details.

Yükleniyor…
İptal
Kaydet