| 1 |
#!/usr/bin/env python3 |
| 2 |
|
| 3 |
import argparse |
| 4 |
|
| 5 |
from crazy_complete import argparse_mod |
| 6 |
|
| 7 |
argp = argparse.ArgumentParser(prog='example', description='Example program') |
| 8 |
|
| 9 |
argp.add_argument('--version', action='version') |
| 10 |
|
| 11 |
subp = argp.add_subparsers(description='commands') |
| 12 |
|
| 13 |
cmdp = subp.add_parser('start', help='Start a process').aliases(['launch']) |
| 14 |
cmdp.add_argument('command', help='Specify a command that shall be run').complete('command') |
| 15 |
cmdp.add_argument('--change-dir', help='Change to directory').complete('directory') |
| 16 |
cmdp.add_argument('--mode', '-m', help='Specify mode', choices=['auto', 'manual', 'debug']) |
| 17 |
|
| 18 |
cmdp = subp.add_parser('stop', help='Stop a process').aliases(['kill']) |
| 19 |
cmdp.add_argument('--force', '-f', help='Force stopping the process', action='store_true') |