Keep the mnemonic variables from the mnemonic command (closes #80) #83

Merged
clawbot merged 1 commits from issue-80-mnemonic-command-env into next 2026-10-14 20:48:22 +02:00
Collaborator

The mnemonic command (--mnemonic-command or KEYFUNC_MNEMONIC_COMMAND) ran with the tool's whole environment, so a mnemonic set in KEYFUNC_MNEMONIC was handed to it. It now runs with the environment ssh and sftp already get: KEYFUNC_MNEMONIC and KEYFUNC_MNEMONIC_COMMAND removed, everything else kept.

The function that builds that environment moves from internal/cli/ssh/ssh.go into internal/mnemonic as ChildEnv, beside the two variable names, and the mnemonic command, ssh and sftp all use it. The README's "Giving it the mnemonic" now names the mnemonic command with ssh and sftp.

The new test in internal/mnemonic/mnemonic_test.go sets both variables, runs a mnemonic command that writes its environment to a file and then prints a mnemonic, and checks that neither variable reached the command while a third variable set beside them did. It fails on the code before this change.

Not shown by the diff: a mnemonic command that runs keyfunc itself (for example keyfunc mnemonic -n 1) no longer finds the main mnemonic in either variable and has to be given it another way, such as its own --mnemonic-command. This follows from the definition of done.

Model: opus-5-5

The mnemonic command (`--mnemonic-command` or `KEYFUNC_MNEMONIC_COMMAND`) ran with the tool's whole environment, so a mnemonic set in `KEYFUNC_MNEMONIC` was handed to it. It now runs with the environment `ssh` and `sftp` already get: `KEYFUNC_MNEMONIC` and `KEYFUNC_MNEMONIC_COMMAND` removed, everything else kept. The function that builds that environment moves from `internal/cli/ssh/ssh.go` into `internal/mnemonic` as `ChildEnv`, beside the two variable names, and the mnemonic command, `ssh` and `sftp` all use it. The README's "Giving it the mnemonic" now names the mnemonic command with `ssh` and `sftp`. The new test in `internal/mnemonic/mnemonic_test.go` sets both variables, runs a mnemonic command that writes its environment to a file and then prints a mnemonic, and checks that neither variable reached the command while a third variable set beside them did. It fails on the code before this change. Not shown by the diff: a mnemonic command that runs keyfunc itself (for example `keyfunc mnemonic -n 1`) no longer finds the main mnemonic in either variable and has to be given it another way, such as its own `--mnemonic-command`. This follows from the definition of done. Model: opus-5-5
clawbot added the needs-review label 2026-10-14 20:22:44 +02:00
clawbot self-assigned this 2026-10-14 20:22:44 +02:00
clawbot added 1 commit 2026-10-14 20:22:44 +02:00
The mnemonic command ran with the tool's whole environment, so a
mnemonic set in KEYFUNC_MNEMONIC reached it, although the command is
there to supply one of its own. It now gets the environment ssh and
sftp already get, with KEYFUNC_MNEMONIC and KEYFUNC_MNEMONIC_COMMAND
removed. The function that builds that environment moves from the ssh
command group into internal/mnemonic, beside the two variable names,
so all three programs use the one copy. The README says so.

Model: opus-5-5
Author
Collaborator

Review passed: the mnemonic command now runs without KEYFUNC_MNEMONIC and KEYFUNC_MNEMONIC_COMMAND, which meets the definition of done in #80.

Model: opus-5-5

Review passed: the mnemonic command now runs without `KEYFUNC_MNEMONIC` and `KEYFUNC_MNEMONIC_COMMAND`, which meets the definition of done in https://git.eeqj.de/sneak/keyfunc/issues/80. Model: opus-5-5
clawbot merged commit b02f502928 into next 2026-10-14 20:48:22 +02:00
clawbot deleted branch issue-80-mnemonic-command-env 2026-10-14 20:48:23 +02:00
Sign in to join this conversation.