feat: add path completion, LCP-based suggestions, and validator tests

- Refactored `FalyxCompleter` to support longest common prefix (LCP) completions by default.
- Added `_ensure_quote` helper to auto-quote completions containing spaces/tabs.
- Integrated `_yield_lcp_completions` for consistent completion insertion logic.
- Added `_suggest_paths()` helper to dynamically suggest filesystem paths for arguments of type `Path`.
- Integrated path completion into `suggest_next()` for both positional and flagged arguments.
- Updated `argument_examples.py` to include a `--path` argument (`Path | None`), demonstrating file path completion.
- Enabled `CompleteStyle.COLUMN` for tab-completion menu formatting in interactive sessions.
- Improved bottom bar docstring formatting with fenced code block examples.
- Added safeguard to `word_validator` to reject `"N"` since it’s reserved for `yes_no_validator`.
- Improved help panel rendering for commands (using `Padding` + `Panel`).
- Added full test coverage for:
  - `FalyxCompleter` and LCP behavior (`tests/test_completer/`)
  - All validators (`tests/test_validators/`)
- Bumped version to 0.1.80.
This commit is contained in:
2025-08-03 18:10:32 -04:00
parent 8e306b9eaf
commit a25888f316
18 changed files with 594 additions and 34 deletions

View File

@ -1,5 +1,6 @@
import asyncio
from enum import Enum
from pathlib import Path
from falyx import Falyx
from falyx.action import Action
@ -21,13 +22,14 @@ async def test_args(
service: str,
place: Place = Place.NEW_YORK,
region: str = "us-east-1",
path: Path | None = None,
tag: str | None = None,
verbose: bool | None = None,
number: int | None = None,
) -> str:
if verbose:
print(f"Deploying {service}:{tag}:{number} to {region} at {place}...")
return f"{service}:{tag}:{number} deployed to {region} at {place}"
print(f"Deploying {service}:{tag}:{number} to {region} at {place} from {path}...")
return f"{service}:{tag}:{number} deployed to {region} at {place} from {path}."
def default_config(parser: CommandArgumentParser) -> None:
@ -52,6 +54,11 @@ def default_config(parser: CommandArgumentParser) -> None:
help="Deployment region.",
choices=["us-east-1", "us-west-2", "eu-west-1"],
)
parser.add_argument(
"--path",
type=Path,
help="Path to the configuration file.",
)
parser.add_argument(
"--verbose",
action="store_bool_optional",