equal
deleted
inserted
replaced
1 // Copyright 2018 Frank Schroeder. All rights reserved. |
1 // Copyright 2013-2022 Frank Schroeder. All rights reserved. |
2 // Use of this source code is governed by a BSD-style |
2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. |
3 // license that can be found in the LICENSE file. |
4 |
4 |
5 package properties |
5 package properties |
6 |
6 |
8 |
8 |
9 // MustFlag sets flags that are skipped by dst.Parse when p contains |
9 // MustFlag sets flags that are skipped by dst.Parse when p contains |
10 // the respective key for flag.Flag.Name. |
10 // the respective key for flag.Flag.Name. |
11 // |
11 // |
12 // It's use is recommended with command line arguments as in: |
12 // It's use is recommended with command line arguments as in: |
13 // flag.Parse() |
13 // |
14 // p.MustFlag(flag.CommandLine) |
14 // flag.Parse() |
|
15 // p.MustFlag(flag.CommandLine) |
15 func (p *Properties) MustFlag(dst *flag.FlagSet) { |
16 func (p *Properties) MustFlag(dst *flag.FlagSet) { |
16 m := make(map[string]*flag.Flag) |
17 m := make(map[string]*flag.Flag) |
17 dst.VisitAll(func(f *flag.Flag) { |
18 dst.VisitAll(func(f *flag.Flag) { |
18 m[f.Name] = f |
19 m[f.Name] = f |
19 }) |
20 }) |