From 923e3c08c8472352cb7c0d8eae6c4a8d17064c49 Mon Sep 17 00:00:00 2001 From: blnkoff Date: Wed, 5 Jun 2024 20:17:55 +0300 Subject: [PATCH] Fixing commands `install` and `change` on Windows --- croco_cli/cli/change.py | 2 +- croco_cli/utils.py | 8 +++++--- pyproject.toml | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/croco_cli/cli/change.py b/croco_cli/cli/change.py index 66256cb..51eff3e 100644 --- a/croco_cli/cli/change.py +++ b/croco_cli/cli/change.py @@ -83,7 +83,7 @@ def custom(): database = Database() custom_accounts = database.get_custom_accounts() - if not len(custom_accounts): + if not custom_accounts or not len(custom_accounts): echo_error('There are no custom accounts in the database to change.') return diff --git a/croco_cli/utils.py b/croco_cli/utils.py index fb212a3..8c29cf4 100644 --- a/croco_cli/utils.py +++ b/croco_cli/utils.py @@ -56,7 +56,7 @@ def _show_key_mode( exit_option = Option( name='Exit', description='Return to the terminal', - handler=lambda: None # No-op handler + handler=_term.clear() ) options.append(exit_option) @@ -109,9 +109,11 @@ def _show_key_mode( current_option += 1 else: current_option = 0 - elif key == '\n': + elif key == '\n' or key.name == 'KEY_ENTER': selected_option = options[current_option] - return selected_option['handler']() + break + + return selected_option['handler']() def show_key_mode( diff --git a/pyproject.toml b/pyproject.toml index fa863d7..37bad60 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = 'croco_cli' -version = '0.2.0' +version = '0.2.1' description = 'The CLI for developing Web3-based projects in Croco Factory' authors = ['Alexey '] license = 'MIT'