mirror of
https://git.zavage.net/Zavage-Software/app_skellington.git
synced 2024-12-21 22:29:20 -07:00
build: removing dead code
This commit is contained in:
parent
f0a4bdbced
commit
7647713498
@ -180,9 +180,6 @@ class ApplicationContainer:
|
|||||||
except NoCommandSpecified:
|
except NoCommandSpecified:
|
||||||
print("Failure: No command specified.")
|
print("Failure: No command specified.")
|
||||||
|
|
||||||
def interactive_shell(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def invoke_from_cli(self):
|
def invoke_from_cli(self):
|
||||||
self.invoke_command()
|
self.invoke_command()
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ import inspect
|
|||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from . import app_container
|
from . import NoCommandSpecified, app_container
|
||||||
from ._bootstrap import _bootstrap_logger
|
from ._bootstrap import _bootstrap_logger
|
||||||
|
|
||||||
# If explicit fail is enabled, any command with at least one unknown
|
# If explicit fail is enabled, any command with at least one unknown
|
||||||
@ -41,12 +41,12 @@ class CommandTree:
|
|||||||
|
|
||||||
./scriptname --option="value" [submenu] [command]
|
./scriptname --option="value" [submenu] [command]
|
||||||
|
|
||||||
is different than
|
is different from
|
||||||
|
|
||||||
./scriptname [submenu] [command] --option="value"
|
./scriptname [submenu] [command] --option="value"
|
||||||
|
|
||||||
in that option is being applied to the application in the first example and
|
in that option is being applied to the application in the first example and
|
||||||
applied to the refresh_datasets command (under the nhsn command group) in
|
applied to the command (under the submenu command group) in
|
||||||
the second. In the same way the -h, --help options print different docs
|
the second. In the same way the -h, --help options print different docs
|
||||||
depending on where the help option was passed.
|
depending on where the help option was passed.
|
||||||
"""
|
"""
|
||||||
@ -82,17 +82,7 @@ class CommandTree:
|
|||||||
Creates a root-level submenu with no entries. SubMenu node is
|
Creates a root-level submenu with no entries. SubMenu node is
|
||||||
returned which can have submenus and commands attached to it.
|
returned which can have submenus and commands attached to it.
|
||||||
"""
|
"""
|
||||||
# NOTE(MG) Fix for Python>=3.7,
|
|
||||||
# argparse.ArgumentParser added 'required' argument.
|
|
||||||
# Must also be written into SubMenu.create_submenu.
|
|
||||||
func_args = {"dest": param_name, "metavar": param_name, "required": is_required}
|
func_args = {"dest": param_name, "metavar": param_name, "required": is_required}
|
||||||
if sys.version_info.major == 3 and sys.version_info.minor < 7:
|
|
||||||
if is_required:
|
|
||||||
_bootstrap_logger.warn(
|
|
||||||
"Unable to enforce required submenu: Requires >= Python 3.7"
|
|
||||||
)
|
|
||||||
del func_args["required"]
|
|
||||||
# END fix for Python<3.7
|
|
||||||
|
|
||||||
# Creates an argument as a slot in the underlying argparse.
|
# Creates an argument as a slot in the underlying argparse.
|
||||||
subparsers = self.root_parser.add_subparsers(**func_args)
|
subparsers = self.root_parser.add_subparsers(**func_args)
|
||||||
@ -211,6 +201,12 @@ class CommandTree:
|
|||||||
return None, None, False
|
return None, None, False
|
||||||
|
|
||||||
def run_command(self, args=None):
|
def run_command(self, args=None):
|
||||||
|
"""
|
||||||
|
Args:
|
||||||
|
args (list[str]): Direct from STDIN
|
||||||
|
Raises:
|
||||||
|
NoCommandSpecified for invalid command.
|
||||||
|
"""
|
||||||
args, unk, success = self.parse(args)
|
args, unk, success = self.parse(args)
|
||||||
if not success:
|
if not success:
|
||||||
_bootstrap_logger.info("cli - SystemExit: Perhaps user invoked --help")
|
_bootstrap_logger.info("cli - SystemExit: Perhaps user invoked --help")
|
||||||
@ -226,7 +222,7 @@ class CommandTree:
|
|||||||
cmd = self._lookup_command(args)
|
cmd = self._lookup_command(args)
|
||||||
if cmd is None:
|
if cmd is None:
|
||||||
_bootstrap_logger.critical("cli - Failed to find command.")
|
_bootstrap_logger.critical("cli - Failed to find command.")
|
||||||
return False
|
raise NoCommandSpecified
|
||||||
|
|
||||||
return self._invoke_command(cmd, args)
|
return self._invoke_command(cmd, args)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user