// processArg is provided *Arg and returns *Arg after unmarshaling the first command line argument which is expected to be valid JSON.
510365
func processArg(arg *Arg) (*Arg, error) {
	osArg := libInputOutput.readOSArg()
	// default parameters - can be parsed as JSON
	if osArg == "" {
		osArg = "{}"
	}
	err := json.Unmarshal([]byte(osArg), arg)
	if err != nil {
		return nil, err
	}

	return arg, nil
}
195552
func escapeArgs(args []string) string {
	escapedArgs := make([]string, len(args))
	for i, a := range args {
		escapedArgs[i] = windows.EscapeArg(a)
	}
	return strings.Join(escapedArgs, " ")
}
1193003
func (f *FlagSet) Arg(i int) string {
	if i < 0 || i >= len(f.args) {
		return ""
	}
	return f.args[i]
}
658352
func (p *StringParam) Args() []string {
	return []string{fmt.Sprintf("--%v", p.CLIName()), p.String()}
}
1306079
func ProcessMessage(reader io.Reader, f func([]byte) error) (err error) {
	return TakeMessage(reader, -1, f)
}
950970
func ProcessBaseLayer(path string) error {
	err := processBaseImage(path)
	if err != nil {
		return &os.PathError{Op: "ProcessBaseLayer", Path: path, Err: err}
	}
	return nil
}
771826
func (nc *Conn) processPong() {
	var ch chan struct{}

	nc.mu.Lock()
	if len(nc.pongs) > 0 {
		ch = nc.pongs[0]
		nc.pongs = nc.pongs[1:]
	}
	nc.pout = 0
	nc.mu.Unlock()
	if ch != nil {
		ch <- struct{}{}
	}
}
617047
func (c *Config) Args() []string {
	args := []string{}
	for _, p := range c.Params {
		args = append(args, p.Args()...)
	}
	return args
}
335978
func refuseArgs(command string, args []string) {
	for _, arg := range args {
		if arg == command || strings.HasPrefix(arg, "-") {
			continue
		} else {
			utils.FatalError(trace.BadParameter("unexpected argument: %s", arg))
		}

	}
}
815020
func Process(replacements map[string]string, docstring string) {
	stat, _ := os.Stdin.Stat()
	// We detect whether we have anything on stdin to process
	if (stat.Mode() & os.ModeCharDevice) == 0 {
		var buffer bytes.Buffer
		scanner := bufio.NewScanner(os.Stdin)
		for scanner.Scan() {
			buffer.WriteString(scanner.Text() + "\n")
		}
		value := buffer.String()
		for regex, tmpl := range replacements {
			re := regexp.MustCompile(regex + "(.*)")
			matches := re.FindStringSubmatch(value)
			if len(matches) == 2 {
				args := matches[1]
				args = strings.TrimLeft(args, " ")
				value = re.ReplaceAllString(value, render(tmpl, args))
			}
		}
		fmt.Print(value)
	} else {
		fmt.Println(docstring)
	}
}
733275
func (s *server) processCommand(command Command, e *ev) {
	s.debugln("server.command.process")

	// Create an entry for the command in the log.
	entry, err := s.log.createEntry(s.currentTerm, command, e)

	if err != nil {
		s.debugln("server.command.log.entry.error:", err)
		e.c <- err
		return
	}

	if err := s.log.appendEntry(entry); err != nil {
		s.debugln("server.command.log.error:", err)
		e.c <- err
		return
	}

	s.syncedPeer[s.Name()] = true
	if len(s.peers) == 0 {
		commitIndex := s.log.currentIndex()
		s.log.setCommitIndex(commitIndex)
		s.debugln("commit index ", commitIndex)
	}
}
1073690
func (t *precompilationTypeChecker) AcceptArgument(v tree.Argument) {
	if v.Type == tree.Full {
		t.result = fmt.Errorf("no full arguments allowed - this is probably a programmer error: %s", tree.ExpressionString(v))
	}
}
1309248
func (cniApp *cniAppInfo) processCmd() int {
	urlDict := map[string]string{cniapi.CniCmdAdd: cniApp.serverURL + cniapi.MesosNwIntfAdd,
		cniapi.CniCmdDel: cniApp.serverURL + cniapi.MesosNwIntfDel}

	jsonReq, err := json.Marshal(cniApp.cniMesosAttr)
	if err != nil {
		return cniApp.sendCniErrorResp("failed to convert Mesos attr. to JSON format :" + err.Error())
	}

	jsonBuf := bytes.NewBuffer(jsonReq)
	url := urlDict[cniApp.cniCmd]
	cniLog.Infof("process cni cmd: %s url: %s", cniApp.cniCmd, url)
	return cniApp.handleHTTP(url, jsonBuf)
}
1186074
func (a *AppInstance) processCommand(url string, body string, method string) *CommandResponse {
	jsonMessage, err := json.Marshal(Command{URL: url, Method: method, Body: body})
	if err != nil {
		return &CommandResponse{}
	}

	a.commandChannel <- jsonMessage
	for {
		select {
		case r, r_ok := <-a.responseChannel:
			if r_ok {
				return r
			}
		case <-time.After(5 * time.Second):
			return &CommandResponse{}
		}
	}
}
60451
func ArgsArg(r, o int) ArgSpec {
	return ArgSpec(C._go_MRB_ARGS_ARG(C.int(r), C.int(o)))
}
113164
func StringArg(c *caddy.Controller) (string, error) {
	args := c.RemainingArgs()
	if len(args) != 1 {
		return "", c.ArgErr()
	}
	return args[0], nil
}
669775
func (c *baseClient) WrapProcess(
	fn func(oldProcess func(cmd Cmder) error) func(cmd Cmder) error,
) {
	c.process = fn(c.process)
}