(c *cli.Context)
| 12 | ) |
| 13 | |
| 14 | func commandFromContext(c *cli.Context) string { |
| 15 | cmd := c.Command.FullName() |
| 16 | |
| 17 | for _, f := range c.Command.Flags { |
| 18 | flagname := f.Names()[0] |
| 19 | for _, flagvalue := range contextValue(c, flagname) { |
| 20 | cmd = fmt.Sprintf("%s --%s=%v", cmd, flagname, flagvalue) |
| 21 | } |
| 22 | } |
| 23 | |
| 24 | if c.Args().Len() > 0 { |
| 25 | cmd = fmt.Sprintf("%v %v", cmd, strings.Join(c.Args().Slice(), " ")) |
| 26 | } |
| 27 | |
| 28 | return cmd |
| 29 | } |
| 30 | |
| 31 | // contextValue traverses context and its ancestor contexts to find |
| 32 | // the flag value and returns string slice. |
no test coverage detected