go.fuchsia.dev/jiri@v0.0.0-20240502161911-b66513b29486/cmd/jiri/flag.go (about)

     1  // Copyright 2016 The Fuchsia 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 main
     6  
     7  import (
     8  	"flag"
     9  )
    10  
    11  // isFlagSet returns whether the specified command line flag has been set.
    12  func isFlagSet(fs *flag.FlagSet, name string) bool {
    13  	found := false
    14  	fs.Visit(func(f *flag.Flag) {
    15  		if f.Name == name {
    16  			found = true
    17  		}
    18  	})
    19  	return found
    20  }