updateParentsPflags updates c.parentsPflags by adding new persistent flags of all parents. If c.parentsPflags == nil, it makes new.
()
| 1905 | // new persistent flags of all parents. |
| 1906 | // If c.parentsPflags == nil, it makes new. |
| 1907 | func (c *Command) updateParentsPflags() { |
| 1908 | if c.parentsPflags == nil { |
| 1909 | c.parentsPflags = flag.NewFlagSet(c.DisplayName(), flag.ContinueOnError) |
| 1910 | c.parentsPflags.SetOutput(c.flagErrorBuf) |
| 1911 | c.parentsPflags.SortFlags = false |
| 1912 | } |
| 1913 | |
| 1914 | if c.globNormFunc != nil { |
| 1915 | c.parentsPflags.SetNormalizeFunc(c.globNormFunc) |
| 1916 | } |
| 1917 | |
| 1918 | c.Root().PersistentFlags().AddFlagSet(flag.CommandLine) |
| 1919 | |
| 1920 | c.VisitParents(func(parent *Command) { |
| 1921 | c.parentsPflags.AddFlagSet(parent.PersistentFlags()) |
| 1922 | }) |
| 1923 | } |
| 1924 | |
| 1925 | // commandNameMatches checks if two command names are equal |
| 1926 | // taking into account case sensitivity according to |
no test coverage detected