File: example.py

package info (click to toggle)
crazy-complete 0.3.6-2
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 2,404 kB
  • sloc: python: 7,949; sh: 4,636; makefile: 74
file content (19 lines) | stat: -rwxr-xr-x 805 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env python3

import argparse

from crazy_complete import argparse_mod

argp = argparse.ArgumentParser(prog='example', description='Example program')

argp.add_argument('--version', action='version')

subp = argp.add_subparsers(description='commands')

cmdp = subp.add_parser('start',       help='Start a process').aliases(['launch'])
cmdp.add_argument('command',          help='Specify a command that shall be run').complete('command')
cmdp.add_argument('--change-dir',     help='Change to directory').complete('directory')
cmdp.add_argument('--mode', '-m',     help='Specify mode', choices=['auto', 'manual', 'debug'])

cmdp = subp.add_parser('stop',        help='Stop a process').aliases(['kill'])
cmdp.add_argument('--force', '-f',    help='Force stopping the process', action='store_true')