github.com/SagerNet/gvisor@v0.0.0-20210707092255-7731c139d75c/runsc/flag/flag.go (about)

     1  // Copyright 2019 The gVisor Authors.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  // Package flag wraps flag primitives.
    16  package flag
    17  
    18  import (
    19  	"flag"
    20  )
    21  
    22  // FlagSet is an alias for flag.FlagSet.
    23  type FlagSet = flag.FlagSet
    24  
    25  // Aliases for flag functions.
    26  var (
    27  	Bool        = flag.Bool
    28  	CommandLine = flag.CommandLine
    29  	Int         = flag.Int
    30  	NewFlagSet  = flag.NewFlagSet
    31  	Parse       = flag.Parse
    32  	String      = flag.String
    33  	Uint        = flag.Uint
    34  	Var         = flag.Var
    35  )
    36  
    37  // ContinueOnError is an alias for flag.ContinueOnError.
    38  const ContinueOnError = flag.ContinueOnError
    39  
    40  // Get returns the flag's underlying object.
    41  func Get(v flag.Value) interface{} {
    42  	return v.(flag.Getter).Get()
    43  }