File: demo.py

package info (click to toggle)
decli 0.6.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 192 kB
  • sloc: python: 475; sh: 9; makefile: 5
file content (30 lines) | stat: -rw-r--r-- 681 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
"""Simple app example"""

from decli import cli

data = {
    "prog": "app",
    "arguments": [
        {"name": "--install", "action": "store_true", "group": "opas"},
        {"name": "--purge", "action": "store_false", "group": "opas"},
    ],
    "subcommands": {
        "title": "main",
        "commands": [
            {
                "name": "commit",
                "arguments": [
                    {
                        "name": "--bocha",
                        "action": "store_true",
                        "group": "opas",
                    }
                ],
            }
        ],
    },
}

parser = cli(data)
args = parser.parse_args()
print(args)