]> Cypherpunks repositories - gostls13.git/commit
cmd/internal/str: add utilities for quoting and splitting args
authorJay Conrod <jayconrod@google.com>
Wed, 14 Jul 2021 22:37:06 +0000 (15:37 -0700)
committerJay Conrod <jayconrod@google.com>
Mon, 16 Aug 2021 20:23:03 +0000 (20:23 +0000)
commit41d991e4e1f3a9230cc3832a39dbf49ce9aa191f
treebf035daf0cd03d6d467765ffc12c6b04617eaadb
parent446614182202a57b84c2742c8992c552e5fc7d3b
cmd/internal/str: add utilities for quoting and splitting args

JoinAndQuoteFields does the inverse of SplitQuotedFields: it joins a
list of arguments with spaces into one string, quoting arguments that
contain spaces or quotes.

QuotedStringListFlag uses SplitQuotedFields and JoinAndQuoteFields
together to define new flags that accept lists of arguments.

For golang/go#41400

Change-Id: I4986b753cb5e6fabb5b489bf26aedab889f853f5
Reviewed-on: https://go-review.googlesource.com/c/go/+/334731
Trust: Jay Conrod <jayconrod@google.com>
Trust: Michael Matloob <matloob@golang.org>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-on: https://go-review.googlesource.com/c/go/+/341935
src/cmd/internal/str/str.go
src/cmd/internal/str/str_test.go