Skip to content

Filepaths - #6

Merged
DotoPototo merged 12 commits into
betafrom
filepaths
May 28, 2026
Merged

DotoPototo merged 12 commits into
betafrom
filepaths

Conversation

@DotoPototo

Copy link
Copy Markdown
Owner

This branch adds opt-in filesystem path completion for FileArgument, DirArgument, and FileDirArgument.

Added

  • New opt-in filesystem completion support via WithFilesystemCompletions(true).
  • New filesystem completion options:
    • WithFilesystemCompletionLimit(n) controls the max displayed filesystem candidates.
    • WithHiddenFiles(true) surfaces dotfiles even when the typed prefix does not start with ..
  • Live path candidates while typing file/dir argument values.
  • Directory candidates appear with a trailing / and can be drilled into with repeated Tab.
  • File candidates append a trailing space to signal that the token is complete.
  • Equals-form flag values are supported, including --path=foo and PowerShell-style -Path=foo.
  • Quoted path values are supported, including auto-quoting filenames that contain spaces.
  • ~ expansion is supported outside quotes and inside double quotes; single quotes suppress expansion.
  • Per-token path validity styling:
    • valid path: green
    • partial path: underline
    • invalid path: red
  • New style fields:
    • Input.PathValid
    • Input.PathPartial
    • Input.PathInvalid
  • Directory read caching with a small TTL/LRU cache to avoid repeated filesystem reads while typing.
  • Symlink-aware completion descriptions, such as symlink → file and symlink → dir.
  • README, example app, fuzz targets, and changelog coverage for the new filesystem behavior.

Changed

  • Filesystem argument validation now uses the shared path resolver:
    • ~/... is resolved against the user’s home directory.
    • relative paths resolve from the process working directory.
    • unclosed quotes now return UnclosedQuote instead of a misleading path-not-found error.
  • Tab behavior now auto-accepts a single completion candidate, enabling shell-style path drill-down.
  • Path completion state is refreshed while cycling directory candidates so validity styling tracks the visible candidate.

Notes / Limitations

  • Filesystem completion is off by default.
  • Permission-denied directories silently fall back to normal argument hints.
  • Devices, sockets, and pipes are not shown as candidates, though typed paths still validate according to the existing path rules.
  • Filenames containing literal quote characters are inserted verbatim and may not re-parse as a single token.
  • Multi-token unquoted paths are not recovered after a space is typed.
  • Very large cold directories may still cause a one-time stall on first read.
  • Case sensitivity is a platform heuristic: Linux is treated as case-sensitive, macOS/Windows as case-insensitive.
  • The path overlay is skipped when input is wider than the terminal.

This comment was marked as outdated.

This comment was marked as duplicate.

This comment was marked as duplicate.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 21 out of 21 changed files in this pull request and generated 1 comment.

Comment thread pathcache_test.go Resolved
@DotoPototo
DotoPototo merged commit 31c3d75 into beta May 28, 2026
6 of 8 checks passed
@DotoPototo
DotoPototo deleted the filepaths branch May 28, 2026 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants