Add 'config edit' to open the config file in your editor#255
Merged
Conversation
Adds a 'dispatch config edit' subcommand that writes the current config to disk, opens it in \/\ (falling back to notepad on Windows, vi elsewhere), and re-validates the file after the editor exits so a broken edit is reported instead of silently applied. Updates help text, shell completions (bash/zsh/powershell), and the README. Closes #254 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
# Conflicts: # cmd/dispatch/main.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a
dispatch config editsubcommand that opens the config file in your editor.It writes the current config to disk first (so the file always exists, even on a
fresh install), opens it in your editor, and then re-reads the file after the
editor exits. If the edit left the file unparseable, the error is reported
instead of being silently applied.
Why
Today the only way to change settings is one
config set key valuecall at atime, or hunting down the file path with
config pathand opening it by hand.For anyone who wants to review or change several settings at once, opening the
file directly is faster. This lines up with how tools like
git config --editand
gh configbehave.Editor resolution
$VISUAL$EDITORnotepadon Windows,vielsewhereThe editor value is split on whitespace, so entries like
code --waitkeeptheir flags.
Changes
runConfigEdithandler plusresolveEditorArgv/launchEditorhelpers incmd/dispatch/config.gocmd/dispatch/main.gocmd/dispatch/cli.goTesting
go build ./...go test ./... -count=1go vet ./...golangci-lint runAll green.
Closes #254