Skip to content

fix(tsm): apply single-field edits in tsm edit - #31

Merged
tashian merged 1 commit into
mainfrom
fix/edit-single-field
Nov 30, 2026
Merged

tashian merged 1 commit into
mainfrom
fix/edit-single-field

Conversation

@tashian

@tashian tashian commented Nov 30, 2026

Copy link
Copy Markdown
Owner

Problem

tsm edit ignores a change to one field. For example:

tsm edit gh-pat --display-name "New name" --no-input
No changes specified.

The same failure occurs for --description, --confirm, and --no-confirm. It also occurs in the TUI form when you change only one field.

Cause

runEdit puts name in params first. Then it compares len(params) with 2 to find "no changes". Thus, one change gives a length of 2, and the command stops. With no changes, the command sends an empty vault.edit.

Fix

Compare len(params) with 1.

Tests

Add cmd/edit_test.go. The tests make sure that:

  • Each single flag sends vault.edit with the correct field.
  • --display-name= clears the display name.
  • Two flags send both fields.
  • No flags send no vault.edit.

just test passes.

runEdit seeded params with "name" and then treated len(params) == 2
as "no changes", so an edit of exactly one field was dropped and an
edit with no fields sent an empty vault.edit. Compare against 1.
@tashian
tashian merged commit 144ddb5 into main Nov 30, 2026
1 check failed
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.

1 participant