Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add output formatting option for replace command #88

Merged
merged 1 commit into from
Feb 22, 2021
Merged

add output formatting option for replace command #88

merged 1 commit into from
Feb 22, 2021

Conversation

mattlqx
Copy link
Collaborator

@mattlqx mattlqx commented Feb 21, 2021

my co-worker noted that its hard to share pastes of the replace commands dry-run output because its colorized. supporting a two-line output of changes with +/- prefixed to denote addition and subtraction for each change is better formatted for sharing.

➜ build/vsh_darwin_amd64 -c 'replace -k value myValue KV1/src/a/foo -n'
/KV1/src/a/foo> vmyValue = 1
Skipping write.

➜ build/vsh_darwin_amd64 -c 'replace -k value myValue KV1/src/a/foo -n -o diff'
- /KV1/src/a/foo> value = 1
+ /KV1/src/a/foo> myValue = 1
Skipping write.

// final strings after replacement
replacedKey string
replacedValue string
}

// MatchOutput contains the possible ways of presenting a match
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CodeClimate complains about formatting: Can you run gofmt -w cli/search.go?

my co-worker noted that its hard to share pastes of the replace commands dry-run output because its colorized. supporting a two-line output of changes with +/- prefixed to denote addition and subtraction for each change is better formatted for sharing.

```
➜ build/vsh_darwin_amd64 -c 'replace -k value myValue KV1/src/a/foo -n'
/KV1/src/a/foo> vmyValue = 1
Skipping write.

➜ build/vsh_darwin_amd64 -c 'replace -k value myValue KV1/src/a/foo -n -o diff'
- /KV1/src/a/foo> value = 1
+ /KV1/src/a/foo> myValue = 1
Skipping write.

```
Copy link
Owner

@fishi0x01 fishi0x01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As usual, a very nice addition! Thank you @mattlqx 🙇

@mattlqx mattlqx merged commit 1626231 into master Feb 22, 2021
@mattlqx mattlqx deleted the diff branch February 22, 2021 15:53
@fishi0x01 fishi0x01 mentioned this pull request Feb 22, 2021
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.

2 participants