2 Commits
Author SHA1 Message Date
Mathew Guest 55a9796806 doc: updating contact email 2024-11-16 22:05:18 -07:00
Mathew Guest 7647713498 build: removing dead code 2024-11-16 04:04:56 -07:00
3 changed files with 12 additions and 18 deletions
+2 -1
View File
@@ -81,6 +81,7 @@ eval "$(pyenv init -)"
EOF EOF
``` ```
* reference https://github.com/pyenv/pyenv * reference https://github.com/pyenv/pyenv
* Use pyenv to install desired python version, and/or create any virtual environments you desire
Clone the repo: Clone the repo:
```commandline ```commandline
@@ -147,7 +148,7 @@ MIT no attribution required - https://opensource.org/license/mit-0
* Project page: https://zavage-software.com/portfolio/app_skellington * Project page: https://zavage-software.com/portfolio/app_skellington
* Please report bugs, improvements, or feedback! * Please report bugs, improvements, or feedback!
* Contact: mathew@zavage.net * Contact: mat@zavage.net
* Packing and distribution conforms to PEP 621 https://peps.python.org/pep-0621/ * Packing and distribution conforms to PEP 621 https://peps.python.org/pep-0621/
* Reference https://packaging.python.org/en/latest/guides/distributing-packages-using-setuptools/ * Reference https://packaging.python.org/en/latest/guides/distributing-packages-using-setuptools/
-3
View File
@@ -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()
+10 -14
View File
@@ -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)