make argcomplete optional
In case someone ever messes up the PYTHONPATH this will gracefull degrade
This commit is contained in:
parent
4c4ff01b64
commit
e4fbb08f91
@ -2,7 +2,11 @@
|
|||||||
import argparse
|
import argparse
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
has_argcomplete = True
|
||||||
|
try:
|
||||||
import argcomplete
|
import argcomplete
|
||||||
|
except ImportError:
|
||||||
|
has_argcomplete = False
|
||||||
|
|
||||||
import clan_admin
|
import clan_admin
|
||||||
|
|
||||||
@ -15,6 +19,7 @@ def clan() -> None:
|
|||||||
# init clan admin
|
# init clan admin
|
||||||
parser_admin = subparsers.add_parser("admin")
|
parser_admin = subparsers.add_parser("admin")
|
||||||
clan_admin.make_parser(parser_admin)
|
clan_admin.make_parser(parser_admin)
|
||||||
|
if has_argcomplete:
|
||||||
argcomplete.autocomplete(parser)
|
argcomplete.autocomplete(parser)
|
||||||
parser.parse_args()
|
parser.parse_args()
|
||||||
if len(sys.argv) == 1:
|
if len(sys.argv) == 1:
|
||||||
|
Loading…
Reference in New Issue
Block a user