diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f34f27..82e73b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## ?.?.? - Unreleased + +* New commands `okdata -e` and `okdata -v` for printing the current environment + and the current version of okdata-cli, respectively. + ## 4.1.0 - 2024-04-22 * The minimum required version of `okdata-sdk` is now 3.1.1. This ensures diff --git a/okdata/cli/__main__.py b/okdata/cli/__main__.py index fe6ff4c..c11f52c 100644 --- a/okdata/cli/__main__.py +++ b/okdata/cli/__main__.py @@ -16,9 +16,15 @@ def main(): argv = sys.argv - if len(argv) < 2 or argv[1] == "help": + if len(argv) < 2: BaseCommand().help() return + if argv[1] in ("-e", "--environment"): + BaseCommand().print_env() + return + if argv[1] in ("-v", "--version"): + BaseCommand().print_version() + return command = get_command_class(argv) diff --git a/okdata/cli/command.py b/okdata/cli/command.py index a76fc49..4bd8389 100644 --- a/okdata/cli/command.py +++ b/okdata/cli/command.py @@ -24,7 +24,9 @@ class BaseCommand: okdata pubs [options] okdata status [options] okdata teams [options] + okdata -e | --environment okdata -h | --help + okdata -v | --version Commands available: datasets @@ -119,6 +121,12 @@ def no_data(self, str): def help(self): print(self.__doc__, end="") + def print_env(self): + print(self.sdk.config.resolve_environment(None)) + + def print_version(self): + print(self.version) + def print_error_response(self, response_body): if not isinstance(response_body, dict): print(response_body)