MCPcopy Create free account
hub / github.com/canopyclimate/golive / command

Method command

internal/text/template/parse/parse.go:688–712  ·  view source on GitHub ↗

command: operand (space operand)* space-separated arguments up to a pipeline character or right delimiter. we consume the pipe character but leave the right delim to terminate the action.

()

Source from the content-addressed store, hash-verified

686// space-separated arguments up to a pipeline character or right delimiter.
687// we consume the pipe character but leave the right delim to terminate the action.
688func (t *Tree) command() *CommandNode {
689 cmd := t.newCommand(t.peekNonSpace().pos)
690 for {
691 t.peekNonSpace() // skip leading spaces.
692 operand := t.operand()
693 if operand != nil {
694 cmd.append(operand)
695 }
696 switch token := t.next(); token.typ {
697 case itemSpace:
698 continue
699 case itemRightDelim, itemRightParen:
700 t.backup()
701 case itemPipe:
702 // nothing here; break loop below
703 default:
704 t.unexpected(token, "operand")
705 }
706 break
707 }
708 if len(cmd.Args) == 0 {
709 t.errorf("empty command")
710 }
711 return cmd
712}
713
714// operand:
715//

Callers 1

pipelineMethod · 0.95

Calls 8

newCommandMethod · 0.95
peekNonSpaceMethod · 0.95
operandMethod · 0.95
nextMethod · 0.95
backupMethod · 0.95
unexpectedMethod · 0.95
errorfMethod · 0.95
appendMethod · 0.45

Tested by

no test coverage detected