From 2d72375c48db33e489c7dcaa1d56eac2b940ffe1 Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Tue, 14 Jan 2020 23:25:33 +0300 Subject: [PATCH] Work with From without name --- cmd/sgblog-comment-add/main.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cmd/sgblog-comment-add/main.go b/cmd/sgblog-comment-add/main.go index 728f34e..b967d94 100644 --- a/cmd/sgblog-comment-add/main.go +++ b/cmd/sgblog-comment-add/main.go @@ -80,7 +80,13 @@ func main() { os.Exit(0) } fromCols := strings.Fields(from) - from = strings.Join(fromCols[:len(fromCols)-1], " ") + if len(fromCols) == 1 { + if idx := strings.Index(from, "@"); idx != -1 { + from = strings.Trim(from[:idx], "<>") + } + } else { + from = strings.Join(fromCols[:len(fromCols)-1], " ") + } cmd := exec.Command( *gitCmd, "--git-dir", *gitDir, -- 2.48.1