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

Function parseArgumentToComplete

command/auto_complete.go:222–241  ·  view source on GitHub ↗
(ctx *cli.Context)

Source from the content-addressed store, hash-verified

220}
221
222func parseArgumentToComplete(ctx *cli.Context) string {
223 var arg string
224 args := ctx.Args()
225 l := args.Len()
226
227 if l > 0 {
228 arg = args.Get(l - 1)
229 }
230
231 // argument may start with a quotation mark, in this case we want to trim
232 // that before checking if it has prefix 's3://'.
233 // Beware that we only want to trim the first char, not all of the leading
234 // quotation marks, because those quotation marks may be actual characters.
235 if strings.HasPrefix(arg, "'") {
236 arg = strings.TrimPrefix(arg, "'")
237 } else {
238 arg = strings.TrimPrefix(arg, "\"")
239 }
240 return arg
241}

Callers 2

NewMakeBucketCommandFunction · 0.85
getBashCompleteFnFunction · 0.85

Calls 1

GetMethod · 0.45

Tested by

no test coverage detected