// MonCommand sends a command to one of the monitors, with an input buffer
170199
func (c *Conn) MonCommandWithInputBuffer(args, inputBuffer []byte) (buffer []byte, info string, err error) {
	return c.monCommand(args, inputBuffer)
}
1066983
func AddCommand(f Flag, sig os.Signal, handler SignalHandlerFunc) {
	if f != nil {
		AddFlag(f, sig)
	}
	if handler != nil {
		SetSigHandler(handler, sig)
	}
}
928908
func (s *HealthCheck) SetCommand(v []*string) *HealthCheck {
	s.Command = v
	return s
}
95300
func (tio *Timeout) RunCommand() (<-chan *ExitStatus, error) {
	if err := tio.start(); err != nil {
		return nil, err
	}

	exitChan := make(chan *ExitStatus)
	go func() {
		exitChan <- tio.wait(context.Background())
	}()
	return exitChan, nil
}
1085060
func (cmd *Cmd) monitor() {
	err := cmd.Wait()
	if !cmd.stoppingValue.Load().(bool) {
		cmd.err = err
	}
	close(cmd.stopped)
}
117741
func (c *Conn) WriteCommand(cmd *Command) error {
	c.mtx.Lock()

	_, err := cmd.WriteTo(c)
	if err != nil {
		goto exit
	}
	err = c.Flush()

exit:
	c.mtx.Unlock()
	if err != nil {
		c.log(LogLevelError, "IO error - %s", err)
		c.delegate.OnIOError(c, err)
	}
	return err
}
1306825
func Cmd() *cobra.Command {
	nodeCmd.AddCommand(startCmd())
	nodeCmd.AddCommand(statusCmd())

	return nodeCmd
}
795618
func (c *Client) WriteCommand(handle uint16, value []byte) error {
	if len(value) > c.l2c.TxMTU()-3 {
		return ErrInvalidArgument
	}

	// Acquire and reuse the txBuf, and release it after usage.
	txBuf := <-c.chTxBuf
	defer func() { c.chTxBuf <- txBuf }()

	req := WriteCommand(txBuf[:3+len(value)])
	req.SetAttributeOpcode()
	req.SetAttributeHandle(handle)
	req.SetAttributeValue(value)

	return c.sendCmd(req)
}
51703
func (b *Bus) ListenCommand(et EventType, command Command, lis Listener) {
	b.lock.Lock()
	defer b.lock.Unlock()

	b.appendListener(et, command, lis)
}
202811
func (c *client) doCommand(command string, payload map[string]string) (response []byte, err error) {
	if payload == nil {
		payload = make(map[string]string)
	}

	payload["command"] = command
	payload["nonce"] = strconv.FormatInt(time.Now().UnixNano(), 10)

	return c.do("POST", "tradingApi", payload, true)
}
451035
func NewCommand(name string, args ...interface{}) *Command {
	return &Command{
		name: strings.TrimSpace(name),
		args: args,
	}
}
394635
func NewCommand(name string, runFn func(*cobra.Command, []string)) *cobra.Command {
	return &cobra.Command{Use: name, Run: runFn, PreRun: setupHTTPLogger}
}
703975
func (h *HealthCheck) SetCommand(c Command) *HealthCheck {
	h.Command = &c
	return h
}
54702
func ReadCommand(in *goetty.ByteBuf) (bool, Command, error) {
	for {
		// remember the begin read index,
		// if we found has no enough data, we will resume this read index,
		// and waiting for next.
		backupReaderIndex := in.GetReaderIndex()

		c, err := in.ReadByte()
		if err != nil {
			return false, nil, err
		}

		// 1. Read ( *<number of arguments> CR LF )
		if c != CMDBegin {
			return false, nil, fmt.Errorf("illegal cmd char %d", c)
		}

		// 2. Read number of arguments
		count, argsCount, err := readStringInt(in)
		if count == 0 && err == nil {
			in.SetReaderIndex(backupReaderIndex)
			return false, nil, nil
		} else if err != nil {
			return false, nil, err
		}

		data := make([][]byte, argsCount)

		// 3. Read args
		for i := 0; i < argsCount; i++ {
			if 0 == in.Readable() {
				in.SetReaderIndex(backupReaderIndex)
				return false, nil, nil
			}

			// 3.1 Read ( $<number of bytes of argument 1> CR LF )
			c, err := in.ReadByte()
			if err != nil {
				return false, nil, err
			}

			// 3.2 Read ( *<number of arguments> CR LF )
			if c != ARGBegin {
				return false, nil, fmt.Errorf("illegal arg char %d", c)
			}

			count, argBytesCount, err := readStringInt(in)
			if count == 0 && err == nil {
				in.SetReaderIndex(backupReaderIndex)
				return false, nil, nil
			} else if err != nil {
				return false, nil, err
			} else if count < 2 {
				return false, nil, fmt.Errorf("illegal arg count: %d", count)
			}

			// 3.3  Read ( <argument data> CR LF )
			if argBytesCount+2 > in.Readable() {
				in.SetReaderIndex(backupReaderIndex)
				return false, nil, nil
			}
			count, value, err := in.ReadBytes(argBytesCount + 2)
			if count == 0 && err == nil {
				in.SetReaderIndex(backupReaderIndex)
				return false, nil, nil
			} else if err != nil {
				return false, nil, err
			}

			data[i] = value[:count-2]
		}

		return true, Command(data), nil
	}
}
1320344
func newCheckCommand(m *Main) *CheckCommand {
	return &CheckCommand{
		Stdin:  m.Stdin,
		Stdout: m.Stdout,
		Stderr: m.Stderr,
	}
}
1301093
func (dc *detachedConn) ReadCommand() (Command, error) {
	if dc.closed {
		return Command{}, errors.New("closed")
	}
	if len(dc.cmds) > 0 {
		cmd := dc.cmds[0]
		if len(dc.cmds) == 1 {
			dc.cmds = nil
		} else {
			dc.cmds = dc.cmds[1:]
		}
		return cmd, nil
	}
	cmd, err := dc.rd.ReadCommand()
	if err != nil {
		return Command{}, err
	}
	return cmd, nil
}
4640
func runCommand(ctx context.Context, command []string) error {
	cmd := exec.Command(command[0], command[1:]...)
	cmd.Stderr = os.Stderr
	cmd.Stdout = os.Stdout
	return cmd.Run()
}