README says secret add drops one trailing newline and import keeps it #184

Merged
clawbot merged 1 commits from fix/158-add-newline-docs into next 2026-10-15 05:31:58 +02:00
Collaborator

secret add drops one trailing newline from stdin, secret import stores a file's bytes unchanged, and secret get writes the stored value with no newline added. The README described none of that, so a value ending in a newline, such as a PEM key piped into add, came back one byte shorter with nothing to explain why.

The README entries for secret add, secret get and secret import now state each rule, and the add entry points to import for keeping a file's final newline. A new test in internal/cli/trailing_newline_test.go stores a\n\n through add and through import and checks that add kept two bytes and import three.

The behaviour itself is unchanged, and add gets no option to keep the newline, as the plan on the issue decided.

Issue: #158

Deviation: the test cannot fail before this change, since no program code changes; it fails when add is made to keep the newline.

Model: opus-5-5

`secret add` drops one trailing newline from stdin, `secret import` stores a file's bytes unchanged, and `secret get` writes the stored value with no newline added. The README described none of that, so a value ending in a newline, such as a PEM key piped into `add`, came back one byte shorter with nothing to explain why. The README entries for `secret add`, `secret get` and `secret import` now state each rule, and the `add` entry points to `import` for keeping a file's final newline. A new test in `internal/cli/trailing_newline_test.go` stores `a\n\n` through `add` and through `import` and checks that `add` kept two bytes and `import` three. The behaviour itself is unchanged, and `add` gets no option to keep the newline, as the plan on the issue decided. Issue: https://git.eeqj.de/sneak/secret/issues/158 Deviation: the test cannot fail before this change, since no program code changes; it fails when `add` is made to keep the newline. Model: opus-5-5
clawbot added the needs-review label 2026-10-15 03:56:36 +02:00
clawbot self-assigned this 2026-10-15 03:56:36 +02:00
clawbot force-pushed fix/158-add-newline-docs from 441b87105e to aa2e8ab97f 2026-10-15 04:02:59 +02:00 Compare
clawbot added 1 commit 2026-10-15 04:56:16 +02:00
`secret add` drops one trailing newline from stdin, so
`echo value | secret add name` stores `value`. `secret import` stores a
file's bytes unchanged, and `secret get` writes the value with no
newline added. The README said none of this, so a PEM key piped into
`add` came back one byte short with no hint why. Its entries for `add`,
`get` and `import` now state each rule. A new test stores `a\n\n`
through `add` and through `import` and checks that `add` kept two bytes
and `import` three. No program code changes.

The new test passes on the code before this change; it fails when `add` keeps the newline.

Model: opus-5-5
clawbot force-pushed fix/158-add-newline-docs from aa2e8ab97f to 287f33f386 2026-10-15 04:56:16 +02:00 Compare
Author
Collaborator

Review passed.

Model: opus-5-5

Review passed. Model: opus-5-5
clawbot merged commit 6bc95f7c69 into next 2026-10-15 05:31:58 +02:00
clawbot deleted branch fix/158-add-newline-docs 2026-10-15 05:31:58 +02:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/secret#184