MCPcopy Create free account
hub / github.com/52funny/pikpakcli / inspectShellArgs

Function inspectShellArgs

internal/shell/shell.go:512–548  ·  view source on GitHub ↗
(args []string)

Source from the content-addressed store, hash-verified

510}
511
512func inspectShellArgs(args []string) shellArgFlags {
513 var flags shellArgFlags
514 stopFlags := false
515 for i := 0; i < len(args); i++ {
516 token := args[i]
517 if stopFlags {
518 flags.positionals++
519 continue
520 }
521 switch {
522 case token == "--":
523 stopFlags = true
524 case token == "--path" || token == "-p":
525 flags.hasPath = true
526 if i+1 < len(args) {
527 i++
528 }
529 case strings.HasPrefix(token, "--path=") || strings.HasPrefix(token, "-p="):
530 flags.hasPath = true
531 case token == "--parent-id" || token == "-P":
532 flags.hasParentID = true
533 if i+1 < len(args) {
534 i++
535 }
536 case token == "--rules":
537 if i+1 < len(args) {
538 i++
539 }
540 case strings.HasPrefix(token, "--parent-id=") || strings.HasPrefix(token, "-P="):
541 flags.hasParentID = true
542 case strings.HasPrefix(token, "-"):
543 default:
544 flags.positionals++
545 }
546 }
547 return flags
548}
549
550func rewritePathFlagValues(args []string, currentPath string) []string {
551 rewritten := append([]string{}, args...)

Callers 1

adaptShellArgsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected