Skip to content

Commit

Permalink
handle editor having arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
coryb committed Feb 22, 2015
1 parent 3e6f2b3 commit 7186fb3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export GOPATH=$(shell pwd)

build:
cd src/github.com/Netflix-Skunkworks/go-jira/jira; \
go install -v
go get -v

all:
mkdir -p $(DIST); \
Expand All @@ -28,3 +28,6 @@ all:
echo "Building for $$p"; \
GOOS=$${p/-*/} GOARCH=$${p/*-/} go build -v -o $(DIST)/jira-$$p; \
done

fmt:
gofmt -s -w jira
7 changes: 5 additions & 2 deletions jira/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"bytes"
"encoding/json"
"fmt"
"github.com/kballard/go-shellquote"
"github.com/op/go-logging"
"gopkg.in/yaml.v2"
"io/ioutil"
Expand Down Expand Up @@ -247,8 +248,10 @@ func (c *Cli) editTemplate(template string, tmpFilePrefix string, templateData m

for true {
if editing {
log.Debug("Running: %s %s", editor, tmpFileName)
cmd := exec.Command(editor, tmpFileName)
shell, _ := shellquote.Split(editor)
shell = append(shell, tmpFileName)
log.Debug("Running: %#v", shell)
cmd := exec.Command(shell[0], shell[1:]...)
cmd.Stdout, cmd.Stderr, cmd.Stdin = os.Stdout, os.Stderr, os.Stdin
if err := cmd.Run(); err != nil {
log.Error("Failed to edit template with %s: %s", editor, err)
Expand Down

0 comments on commit 7186fb3

Please sign in to comment.