Exemple #1
0
func cmdApi(c *cli.Context) error {
	if len(c.Args()) > 0 {
		return stdcli.Errorf("ERROR: `convox api` does not take arguments. Perhaps you meant `convox api get`?", 1)
	}

	stdcli.Usage(c, "")
	return nil
}
Exemple #2
0
func cmdExec(c *cli.Context) error {
	fd := os.Stdin.Fd()

	var h, w int

	if terminal.IsTerminal(int(fd)) {
		stdinState, err := terminal.GetState(int(fd))
		if err != nil {
			return stdcli.Error(err)
		}

		defer terminal.Restore(int(fd), stdinState)

		w, h, err = terminal.GetSize(int(fd))
		if err != nil {
			return stdcli.Error(err)
		}
	}

	_, app, err := stdcli.DirApp(c, ".")
	if err != nil {
		return stdcli.Error(err)
	}

	if len(c.Args()) < 2 {
		stdcli.Usage(c, "exec")
		return nil
	}

	ps := c.Args()[0]

	code, err := rackClient(c).ExecProcessAttached(app, ps, strings.Join(c.Args()[1:], " "), os.Stdin, os.Stdout, h, w)
	if err != nil {
		return stdcli.Error(err)
	}

	return stdcli.Errorf("", code)
}