Skip to content

fix(env): report Updated when vp env pin overwrites an existing file - #3377

Draft
CheHyeonYeong wants to merge 1 commit into
voidzero-dev:mainfrom
CheHyeonYeong:fix/env-pin-created-updated-message
Draft

CheHyeonYeong wants to merge 1 commit into
voidzero-dev:mainfrom
CheHyeonYeong:fix/env-pin-created-updated-message

Conversation

@CheHyeonYeong

Copy link
Copy Markdown

Closes #3370

vp env pin always printed Created .node-version even when it overwrote an existing file (with or without --force). The .nvmrc path had the opposite problem: --target nvmrc printed Updated .nvmrc when it created a new file.

Both paths now print Created or Updated depending on whether the file existed before the write.

$ echo v24 > .node-version
$ vp env pin 22.13.0 --force --no-install
✓ Pinned Node.js version to 22.13.0
  Updated .node-version in /tmp/...

Changes

  • pin.rs: track whether the target file existed and print the message through a shared print_pin_file_written helper
  • Snapshots
    • node_version_keeps_priority_over_nvmrc: Created → Updated (overwrites an existing .node-version)
    • explicit_nvmrc_target_can_create_a_pin: Updated → Created (creates a new .nvmrc)
    • new node_version_pin_reports_created_then_updated case covering create → overwrite
  • rfcs/env-command.md: overwrite examples now show the Updated .node-version line

Testing

  • VP_SNAP_SKIP_FLAVORS=local cargo test -p vp_cli_snapshots -- command_env_pin (25 passed)
  • cargo test -p vp_global_cli pin, cargo clippy -p vp_global_cli, cargo fmt --check

`vp env pin` always printed "Created .node-version" even when it
overwrote an existing file, and "Updated .nvmrc" even when it created
a new one. Report Created or Updated based on whether the file existed.

Closes voidzero-dev#3370

This branch has not been deployed

No deployments
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.

vp env pin: says "Created .node-version" when overwriting an existing file

1 participant