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.
Files changed (67) hide show
  1. {falyx-0.1.54 → falyx-0.1.55}/PKG-INFO +1 -1
  2. falyx-0.1.55/falyx/falyx_completer.py +53 -0
  3. {falyx-0.1.54 → falyx-0.1.55}/falyx/parser/command_argument_parser.py +0 -2
  4. falyx-0.1.55/falyx/version.py +1 -0
  5. {falyx-0.1.54 → falyx-0.1.55}/pyproject.toml +1 -1
  6. falyx-0.1.54/falyx/version.py +0 -1
  7. {falyx-0.1.54 → falyx-0.1.55}/LICENSE +0 -0
  8. {falyx-0.1.54 → falyx-0.1.55}/README.md +0 -0
  9. {falyx-0.1.54 → falyx-0.1.55}/falyx/.pytyped +0 -0
  10. {falyx-0.1.54 → falyx-0.1.55}/falyx/__init__.py +0 -0
  11. {falyx-0.1.54 → falyx-0.1.55}/falyx/__main__.py +0 -0
  12. {falyx-0.1.54 → falyx-0.1.55}/falyx/action/.pytyped +0 -0
  13. {falyx-0.1.54 → falyx-0.1.55}/falyx/action/__init__.py +0 -0
  14. {falyx-0.1.54 → falyx-0.1.55}/falyx/action/action.py +0 -0
  15. {falyx-0.1.54 → falyx-0.1.55}/falyx/action/action_factory.py +0 -0
  16. {falyx-0.1.54 → falyx-0.1.55}/falyx/action/action_group.py +0 -0
  17. {falyx-0.1.54 → falyx-0.1.55}/falyx/action/action_mixins.py +0 -0
  18. {falyx-0.1.54 → falyx-0.1.55}/falyx/action/action_types.py +0 -0
  19. {falyx-0.1.54 → falyx-0.1.55}/falyx/action/base_action.py +0 -0
  20. {falyx-0.1.54 → falyx-0.1.55}/falyx/action/chained_action.py +0 -0
  21. {falyx-0.1.54 → falyx-0.1.55}/falyx/action/fallback_action.py +0 -0
  22. {falyx-0.1.54 → falyx-0.1.55}/falyx/action/http_action.py +0 -0
  23. {falyx-0.1.54 → falyx-0.1.55}/falyx/action/io_action.py +0 -0
  24. {falyx-0.1.54 → falyx-0.1.55}/falyx/action/literal_input_action.py +0 -0
  25. {falyx-0.1.54 → falyx-0.1.55}/falyx/action/load_file_action.py +0 -0
  26. {falyx-0.1.54 → falyx-0.1.55}/falyx/action/menu_action.py +0 -0
  27. {falyx-0.1.54 → falyx-0.1.55}/falyx/action/process_action.py +0 -0
  28. {falyx-0.1.54 → falyx-0.1.55}/falyx/action/process_pool_action.py +0 -0
  29. {falyx-0.1.54 → falyx-0.1.55}/falyx/action/prompt_menu_action.py +0 -0
  30. {falyx-0.1.54 → falyx-0.1.55}/falyx/action/save_file_action.py +0 -0
  31. {falyx-0.1.54 → falyx-0.1.55}/falyx/action/select_file_action.py +0 -0
  32. {falyx-0.1.54 → falyx-0.1.55}/falyx/action/selection_action.py +0 -0
  33. {falyx-0.1.54 → falyx-0.1.55}/falyx/action/shell_action.py +0 -0
  34. {falyx-0.1.54 → falyx-0.1.55}/falyx/action/signal_action.py +0 -0
  35. {falyx-0.1.54 → falyx-0.1.55}/falyx/action/user_input_action.py +0 -0
  36. {falyx-0.1.54 → falyx-0.1.55}/falyx/bottom_bar.py +0 -0
  37. {falyx-0.1.54 → falyx-0.1.55}/falyx/command.py +0 -0
  38. {falyx-0.1.54 → falyx-0.1.55}/falyx/config.py +0 -0
  39. {falyx-0.1.54 → falyx-0.1.55}/falyx/context.py +0 -0
  40. {falyx-0.1.54 → falyx-0.1.55}/falyx/debug.py +0 -0
  41. {falyx-0.1.54 → falyx-0.1.55}/falyx/exceptions.py +0 -0
  42. {falyx-0.1.54 → falyx-0.1.55}/falyx/execution_registry.py +0 -0
  43. {falyx-0.1.54 → falyx-0.1.55}/falyx/falyx.py +0 -0
  44. {falyx-0.1.54 → falyx-0.1.55}/falyx/hook_manager.py +0 -0
  45. {falyx-0.1.54 → falyx-0.1.55}/falyx/hooks.py +0 -0
  46. {falyx-0.1.54 → falyx-0.1.55}/falyx/init.py +0 -0
  47. {falyx-0.1.54 → falyx-0.1.55}/falyx/logger.py +0 -0
  48. {falyx-0.1.54 → falyx-0.1.55}/falyx/menu.py +0 -0
  49. {falyx-0.1.54 → falyx-0.1.55}/falyx/options_manager.py +0 -0
  50. {falyx-0.1.54 → falyx-0.1.55}/falyx/parser/.pytyped +0 -0
  51. {falyx-0.1.54 → falyx-0.1.55}/falyx/parser/__init__.py +0 -0
  52. {falyx-0.1.54 → falyx-0.1.55}/falyx/parser/argument.py +0 -0
  53. {falyx-0.1.54 → falyx-0.1.55}/falyx/parser/argument_action.py +0 -0
  54. {falyx-0.1.54 → falyx-0.1.55}/falyx/parser/parsers.py +0 -0
  55. {falyx-0.1.54 → falyx-0.1.55}/falyx/parser/signature.py +0 -0
  56. {falyx-0.1.54 → falyx-0.1.55}/falyx/parser/utils.py +0 -0
  57. {falyx-0.1.54 → falyx-0.1.55}/falyx/prompt_utils.py +0 -0
  58. {falyx-0.1.54 → falyx-0.1.55}/falyx/protocols.py +0 -0
  59. {falyx-0.1.54 → falyx-0.1.55}/falyx/retry.py +0 -0
  60. {falyx-0.1.54 → falyx-0.1.55}/falyx/retry_utils.py +0 -0
  61. {falyx-0.1.54 → falyx-0.1.55}/falyx/selection.py +0 -0
  62. {falyx-0.1.54 → falyx-0.1.55}/falyx/signals.py +0 -0
  63. {falyx-0.1.54 → falyx-0.1.55}/falyx/tagged_table.py +0 -0
  64. {falyx-0.1.54 → falyx-0.1.55}/falyx/themes/__init__.py +0 -0
  65. {falyx-0.1.54 → falyx-0.1.55}/falyx/themes/colors.py +0 -0
  66. {falyx-0.1.54 → falyx-0.1.55}/falyx/utils.py +0 -0
  67. {falyx-0.1.54 → falyx-0.1.55}/falyx/validators.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: falyx
3
- Version: 0.1.54
3
+ Version: 0.1.55
4
4
  Summary: Reliable and introspectable async CLI action framework.
5
5
  License: MIT
6
6
  Author: Roland Thomas Jr
@@ -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"
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "falyx"
3
- version = "0.1.54"
3
+ version = "0.1.55"
4
4
  description = "Reliable and introspectable async CLI action framework."
5
5
  authors = ["Roland Thomas Jr <roland@rtj.dev>"]
6
6
  license = "MIT"
@@ -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