github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/cmd/internal/quoted/quoted.go (about)

     1  // Copyright 2017 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // Package quoted provides string manipulation utilities.
     6  package quoted
     7  
     8  import (
     9  	"github.com/shogo82148/std/flag"
    10  )
    11  
    12  // Split splits s into a list of fields,
    13  // allowing single or double quotes around elements.
    14  // There is no unescaping or other processing within
    15  // quoted fields.
    16  //
    17  // Keep in sync with cmd/dist/quoted.go
    18  func Split(s string) ([]string, error)
    19  
    20  // Join joins a list of arguments into a string that can be parsed
    21  // with Split. Arguments are quoted only if necessary; arguments
    22  // without spaces or quotes are kept as-is. No argument may contain both
    23  // single and double quotes.
    24  func Join(args []string) (string, error)
    25  
    26  // A Flag parses a list of string arguments encoded with Join.
    27  // It is useful for flags like cmd/link's -extldflags.
    28  type Flag []string
    29  
    30  var _ flag.Value = (*Flag)(nil)
    31  
    32  func (f *Flag) Set(v string) error
    33  
    34  func (f *Flag) String() string