diff --git a/falyx/action/selection_action.py b/falyx/action/selection_action.py index 1ba41d0..1047267 100644 --- a/falyx/action/selection_action.py +++ b/falyx/action/selection_action.py @@ -344,7 +344,7 @@ class SelectionAction(BaseAction): selection = [ key for key, sel in self.selections.items() - if sel.value == maybe_result + if sel.value == maybe_result and maybe_result is not None ] if selection: effective_default = selection[0] diff --git a/falyx/parser/command_argument_parser.py b/falyx/parser/command_argument_parser.py index 3272753..85f8654 100644 --- a/falyx/parser/command_argument_parser.py +++ b/falyx/parser/command_argument_parser.py @@ -1155,7 +1155,7 @@ class CommandArgumentParser: for spec in self._arguments: if spec.dest == "help" or spec.dest == "tldr": continue - if spec.required and not result.get(spec.dest): + if spec.required and result.get(spec.dest) is None: help_text = f" help: {spec.help}" if spec.help else "" if ( spec.action == ArgumentAction.ACTION @@ -1316,7 +1316,7 @@ class CommandArgumentParser: for suggestion in arg.suggestions if suggestion_filter(suggestion) ] - if arg.type is Path: + if issubclass(arg.type, Path): return self._suggest_paths(prefix if not cursor_at_end_of_token else ".") return [] @@ -1391,7 +1391,7 @@ class CommandArgumentParser: ): return [] return sorted(next_non_consumed_positional_arg.suggestions) - if next_non_consumed_positional_arg.type == Path: + if issubclass(next_non_consumed_positional_arg.type, Path): if cursor_at_end_of_token: return self._suggest_paths(".") else: @@ -1536,7 +1536,7 @@ class CommandArgumentParser: if suggestion.startswith(last) ) ) - elif arg.type == Path and not cursor_at_end_of_token: + elif issubclass(arg.type, Path) and not cursor_at_end_of_token: suggestions.extend(self._suggest_paths(last)) elif last_keyword_state_in_args and not last_keyword_state_in_args.consumed: suggestions.extend( diff --git a/falyx/version.py b/falyx/version.py index bcb74b8..ea23fb5 100644 --- a/falyx/version.py +++ b/falyx/version.py @@ -1 +1 @@ -__version__ = "0.1.86" +__version__ = "0.1.87" diff --git a/pyproject.toml b/pyproject.toml index a047a71..e8c5504 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "falyx" -version = "0.1.86" +version = "0.1.87" description = "Reliable and introspectable async CLI action framework." authors = ["Roland Thomas Jr "] license = "MIT"