mirror of
https://github.com/opentffoundation/opentf.git
synced 2026-02-14 10:01:05 -05:00
22 lines
424 B
Go
22 lines
424 B
Go
// Copyright (c) The OpenTofu Authors
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
// Copyright (c) 2023 HashiCorp, Inc.
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
package flags
|
|
|
|
import (
|
|
"flag"
|
|
)
|
|
|
|
// FlagIsSet returns whether a flag is explicitly set in a set of flags
|
|
func FlagIsSet(flags *flag.FlagSet, name string) bool {
|
|
isSet := false
|
|
flags.Visit(func(f *flag.Flag) {
|
|
if f.Name == name {
|
|
isSet = true
|
|
}
|
|
})
|
|
return isSet
|
|
}
|