1 // Copyright 2017 Frank Schroeder. 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.
9 // MustFlag sets flags that are skipped by dst.Parse when p contains
10 // the respective key for flag.Flag.Name.
12 // It's use is recommended with command line arguments as in:
14 // p.MustFlag(flag.CommandLine)
15 func (p *Properties) MustFlag(dst *flag.FlagSet) {
16 m := make(map[string]*flag.Flag)
17 dst.VisitAll(func(f *flag.Flag) {
20 dst.Visit(func(f *flag.Flag) {
21 delete(m, f.Name) // overridden
24 for name, f := range m {
30 if err := f.Value.Set(v); err != nil {