MCPcopy Index your code
hub / github.com/peak/s5cmd / commandFromContext

Function commandFromContext

command/context.go:14–29  ·  view source on GitHub ↗
(c *cli.Context)

Source from the content-addressed store, hash-verified

12)
13
14func 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.

Callers 15

NewCopyCommandFunction · 0.85
NewCopyFunction · 0.85
NewPresignCommandFunction · 0.85
NewMakeBucketCommandFunction · 0.85
NewRemoveBucketCommandFunction · 0.85
NewHeadCommandFunction · 0.85
NewSyncCommandFunction · 0.85
NewSyncFunction · 0.85
NewCatCommandFunction · 0.85
NewRunCommandFunction · 0.85
RunMethod · 0.85
NewPipeCommandFunction · 0.85

Calls 3

contextValueFunction · 0.85
NamesMethod · 0.80
JoinMethod · 0.80

Tested by

no test coverage detected