fix: the completion subcommand should assume the CLI is named codex, not codex-cli (#1496)

Current 0.4.0 release:

```
~/code/codex2/codex-rs$ codex completion | head
_codex-cli() {
    local i cur prev opts cmd
    COMPREPLY=()
    if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
        cur="$2"
    else
        cur="${COMP_WORDS[COMP_CWORD]}"
    fi
    prev="$3"
    cmd=""
```

with this change:

```
~/code/codex2/codex-rs$ just codex completion | head
cargo run --bin codex -- "$@"
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.82s
     Running `target/debug/codex completion`
_codex() {
    local i cur prev opts cmd
    COMPREPLY=()
    if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
        cur="$2"
    else
        cur="${COMP_WORDS[COMP_CWORD]}"
    fi
    prev="$3"
    cmd=""
```
This commit is contained in:
Michael Bolin
2025-07-09 14:08:35 -07:00
committed by GitHub
parent 4a15ebc1ca
commit 268267b59e

View File

@@ -155,6 +155,6 @@ fn prepend_config_flags(
fn print_completion(cmd: CompletionCommand) {
let mut app = MultitoolCli::command();
let name = app.get_name().to_string();
let name = "codex";
generate(cmd.shell, &mut app, name, &mut std::io::stdout());
}