mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-python
synced 2026-01-15 09:53:32 +01:00
Cmds: Add argcomplete support
argcomplete takes the arguments added to argparse, and builds bash completion with it. Add it to all Cmds based executables. Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
428692ea3a
commit
1e16c0ffb1
2 changed files with 3 additions and 2 deletions
|
|
@ -1,7 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from typing import Optional
|
||||
import os, sys, argparse, importlib, inspect, re, pickle, asyncio, cProfile
|
||||
import os, sys, argcomplete, argparse, importlib, inspect, re, pickle, asyncio, cProfile
|
||||
from argparse import ArgumentParser
|
||||
|
||||
import jwutils
|
||||
|
|
@ -91,6 +91,7 @@ class Cmds: # export
|
|||
self.__add_cmd_to_parser(cmd, subparsers)
|
||||
|
||||
async def __run(self, argv=None):
|
||||
argcomplete.autocomplete(self.__parser)
|
||||
self.args = self.__parser.parse_args(args=argv)
|
||||
set_flags(self.args.log_flags)
|
||||
set_level(self.args.log_level)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue