From: Sergey Matveev Date: Tue, 14 Jan 2020 20:25:33 +0000 (+0300) Subject: Work with From without name X-Git-Tag: v0.2.0~5 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=2d72375c48db33e489c7dcaa1d56eac2b940ffe1;p=sgblog.git Work with From without name --- 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,