Skip to content

Commit

Permalink
Fix: ui_context: enter_level() should not check requirements for non-…
Browse files Browse the repository at this point in the history
…functional subcommands (#1498)

Fix a regression introduced in ac812f1.
  • Loading branch information
liangxin1300 authored Jul 31, 2024
2 parents ae058b0 + 99d6430 commit 2abacf2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions crmsh/ui_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
logger = log.setup_logger(__name__)
logger_utils = log.LoggerUtils(logger)

_NON_FUNCTIONAL_COMMANDS = {'help', 'cd', 'ls', 'quit', 'up'}
_NON_FUNCTIONAL_COMMANDS = {'help', 'ls'}
_NON_FUNCTIONAL_OPTIONS = {'--help', '--help-without-redirect'}

class Context(object):
Expand Down Expand Up @@ -257,8 +257,10 @@ def enter_level(self, level):
self._in_transit = True

entry = level()
if 'requires' in dir(entry) and not entry.requires():
self.fatal_error("Missing requirements")
if self.command_name not in _NON_FUNCTIONAL_COMMANDS \
and all(arg not in _NON_FUNCTIONAL_OPTIONS for arg in self.command_args):
if 'requires' in dir(entry) and not entry.requires():
self.fatal_error("Missing requirements")
self.stack.append(entry)
self.clear_readline_cache()

Expand Down

0 comments on commit 2abacf2

Please sign in to comment.