falyx 0.1.54__tar.gz → 0.1.55__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {falyx-0.1.54 → falyx-0.1.55}/PKG-INFO +1 -1
- falyx-0.1.55/falyx/falyx_completer.py +53 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/parser/command_argument_parser.py +0 -2
- falyx-0.1.55/falyx/version.py +1 -0
- {falyx-0.1.54 → falyx-0.1.55}/pyproject.toml +1 -1
- falyx-0.1.54/falyx/version.py +0 -1
- {falyx-0.1.54 → falyx-0.1.55}/LICENSE +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/README.md +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/.pytyped +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/__init__.py +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/__main__.py +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/action/.pytyped +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/action/__init__.py +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/action/action.py +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/action/action_factory.py +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/action/action_group.py +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/action/action_mixins.py +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/action/action_types.py +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/action/base_action.py +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/action/chained_action.py +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/action/fallback_action.py +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/action/http_action.py +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/action/io_action.py +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/action/literal_input_action.py +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/action/load_file_action.py +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/action/menu_action.py +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/action/process_action.py +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/action/process_pool_action.py +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/action/prompt_menu_action.py +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/action/save_file_action.py +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/action/select_file_action.py +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/action/selection_action.py +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/action/shell_action.py +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/action/signal_action.py +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/action/user_input_action.py +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/bottom_bar.py +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/command.py +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/config.py +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/context.py +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/debug.py +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/exceptions.py +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/execution_registry.py +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/falyx.py +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/hook_manager.py +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/hooks.py +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/init.py +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/logger.py +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/menu.py +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/options_manager.py +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/parser/.pytyped +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/parser/__init__.py +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/parser/argument.py +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/parser/argument_action.py +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/parser/parsers.py +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/parser/signature.py +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/parser/utils.py +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/prompt_utils.py +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/protocols.py +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/retry.py +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/retry_utils.py +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/selection.py +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/signals.py +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/tagged_table.py +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/themes/__init__.py +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/themes/colors.py +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/utils.py +0 -0
- {falyx-0.1.54 → falyx-0.1.55}/falyx/validators.py +0 -0
@@ -0,0 +1,53 @@
|
|
1
|
+
import shlex
|
2
|
+
from typing import Iterable
|
3
|
+
|
4
|
+
from prompt_toolkit.completion import Completer, Completion
|
5
|
+
|
6
|
+
from falyx.parser.command_argument_parser import CommandArgumentParser
|
7
|
+
|
8
|
+
|
9
|
+
class FalyxCompleter(Completer):
|
10
|
+
def __init__(self, falyx: "Falyx") -> None:
|
11
|
+
self.falyx = falyx
|
12
|
+
|
13
|
+
def get_completions(self, document, complete_event) -> Iterable[Completion]:
|
14
|
+
text = document.text_before_cursor.strip()
|
15
|
+
if not text:
|
16
|
+
yield from self._complete_command("")
|
17
|
+
return
|
18
|
+
|
19
|
+
try:
|
20
|
+
tokens = shlex.split(text)
|
21
|
+
except ValueError:
|
22
|
+
return # unmatched quotes or syntax error
|
23
|
+
|
24
|
+
if not tokens:
|
25
|
+
yield from self._complete_command("")
|
26
|
+
return
|
27
|
+
|
28
|
+
command_token = tokens[0]
|
29
|
+
command_key = command_token.lstrip("?").upper()
|
30
|
+
command = self.falyx._name_map.get(command_key)
|
31
|
+
|
32
|
+
if command is None:
|
33
|
+
yield from self._complete_command(command_token)
|
34
|
+
return
|
35
|
+
|
36
|
+
used_flags = set(tokens[1:]) # simplistic
|
37
|
+
parser: CommandArgumentParser = command.arg_parser or CommandArgumentParser()
|
38
|
+
for arg in parser._keyword_list:
|
39
|
+
for flag in arg.flags:
|
40
|
+
if flag not in used_flags:
|
41
|
+
yield Completion(flag, start_position=0)
|
42
|
+
|
43
|
+
for dest, arg in parser._positional.items():
|
44
|
+
if dest not in used_flags:
|
45
|
+
yield Completion(arg.dest, start_position=0)
|
46
|
+
|
47
|
+
def _complete_command(self, prefix: str) -> Iterable[Completion]:
|
48
|
+
seen = set()
|
49
|
+
for cmd in self.falyx.commands.values():
|
50
|
+
for key in [cmd.key] + cmd.aliases:
|
51
|
+
if key not in seen and key.upper().startswith(prefix.upper()):
|
52
|
+
yield Completion(key, start_position=-len(prefix))
|
53
|
+
seen.add(key)
|
@@ -645,8 +645,6 @@ class CommandArgumentParser:
|
|
645
645
|
if arg in self._keyword:
|
646
646
|
next_flagged_index = index
|
647
647
|
break
|
648
|
-
print(f"next_flagged_index: {next_flagged_index}")
|
649
|
-
print(f"{self._keyword_list=}")
|
650
648
|
if next_flagged_index == -1:
|
651
649
|
next_flagged_index = len(args)
|
652
650
|
args_consumed = await self._consume_all_positional_args(
|
@@ -0,0 +1 @@
|
|
1
|
+
__version__ = "0.1.55"
|
falyx-0.1.54/falyx/version.py
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
__version__ = "0.1.54"
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|