apple / apple/swift-argument-parser

fish 4.1+ completion scripts should parse the command line by using `read` instead of by using `commandline`

Open
#819 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Swift
Stars
3.8k
Forks
411
Avg merge
7d 14h
Merged PRs (30d)
15

Description

fish 4.1 completion scripts should parse the command line by using `read` instead of by using `commandline`.

`commandline` is broken. [`read`, but not `commandline`, has supposedly been fixed to properly parse command lines for the upcoming fish 4.1](https://github.com/fish-shell/fish-shell/commit/c3626a303113122f388ae1e7ec39cf2000beacca).

Must either redo scripts to use `read` for all versions of fish (expecting better data and/or more options in 4.1+), or use `read` for only 4.1+, but continue to use `commandline` for older fish versions.

**ArgumentParser version:** `main`
**Swift version:** n/a

### Checklist
- [x] If possible, I've reproduced the issue using the `main` branch of this package
- [x] I've searched for [existing GitHub issues](https://github.com/apple/swift-argument-parser/issues)

### Steps to Reproduce
Try completing a custom completion command line token in fish where you have redirects in the command line.

### Expected behavior
Redirects should be included in the `[String]` that represents the command-line tokens.

### Actual behavior
Redirects are not included in the `[String]` that represents the command-line tokens.

See https://github.com/apple/swift-argument-parser/issues/679#issuecomment-2609815690, and potentially other comments on that issue, for some info about how fish command-line parsing is broken, amongst tons of other info.

Contributor guide

Open the contributing guide

Research direction

No files or tests are named. Start by reproducing completion of a custom fish command line containing redirects, then locate the completion scripts that build the [String] of command-line tokens and compare fish's read and commandline behavior across versions. Done means redirects are included in the tokens while compatibility with older fish versions is preserved.

Written by the indexing model from the issue text.

Assessment

Tech stack
fish, swift
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.