mirror of https://github.com/nicolargo/glances.git
Make the shtab optional
This commit is contained in:
parent
50aa49a497
commit
acf54a508e
|
|
@ -14,7 +14,12 @@ import tempfile
|
|||
from logging import DEBUG
|
||||
from warnings import simplefilter
|
||||
|
||||
import shtab
|
||||
try:
|
||||
import shtab
|
||||
except ImportError:
|
||||
shtab_tag = False
|
||||
else:
|
||||
shtab_tag = True
|
||||
|
||||
from glances import __apiversion__, __version__, psutil_version
|
||||
from glances.config import Config
|
||||
|
|
@ -177,12 +182,16 @@ Examples of use:
|
|||
formatter_class=argparse.RawDescriptionHelpFormatter,
|
||||
epilog=self.example_of_use,
|
||||
)
|
||||
shtab.add_argument_to(parser, ["--print-completion"])
|
||||
if shtab_tag:
|
||||
shtab.add_argument_to(parser, ["--print-completion"])
|
||||
parser.add_argument('-V', '--version', action='version', version=self.version_msg())
|
||||
parser.add_argument('-d', '--debug', action='store_true', default=False, dest='debug', help='enable debug mode')
|
||||
parser.add_argument(
|
||||
'-C', '--config', dest='conf_file', help='path to the configuration file'
|
||||
).complete = shtab.FILE
|
||||
if shtab_tag:
|
||||
parser.add_argument(
|
||||
'-C', '--config', dest='conf_file', help='path to the configuration file'
|
||||
).complete = shtab.FILE
|
||||
else:
|
||||
parser.add_argument('-C', '--config', dest='conf_file', help='path to the configuration file')
|
||||
parser.add_argument('-P', '--plugins', dest='plugin_dir', help='path to additional plugin directory')
|
||||
# Disable plugin
|
||||
parser.add_argument(
|
||||
|
|
|
|||
Loading…
Reference in New Issue