Ejemplo n.º 1
0
	Use:   "ps",
	Short: "List an app's processes",
	RunE: func(cmd *cobra.Command, args []string) (err error) {

		appName, err := util.AppName(cmd)
		if err != nil {
			return err
		}

		ps, err := util.ConvoxPs(appName)
		if err != nil {
			return err
		}

		table := tablewriter.NewWriter(os.Stdout)
		table.SetBorder(false)
		table.SetColumnSeparator("")
		table.SetCenterSeparator("")
		table.SetAutoWrapText(false)
		table.Append([]string{"ID", "NAME", "RELEASE", "STARTED", "COMMAND"})

		for _, p := range ps {
			table.Append([]string{p.Id, p.Name, p.Release, util.HumanizeTime(p.Started), p.Command})
		}

		table.Render()

		return nil
	},
}
Ejemplo n.º 2
0
		appName, err := util.AppName(cmd)
		if err != nil {
			return err
		}

		releases, err := util.ConvoxReleases(appName)
		if err != nil {
			return err
		}

		table := tablewriter.NewWriter(os.Stdout)
		table.SetBorder(false)
		table.SetColumnSeparator("")
		table.SetCenterSeparator("")
		table.SetAutoWrapText(false)
		table.Append([]string{"ID", "CREATED", "STATUS"})

		for _, r := range releases {
			table.Append([]string{r.Id, util.HumanizeTime(r.Created), r.Status})
		}

		table.Render()

		return nil
	},
}

func init() {
	RootCmd.AddCommand(releasesCmd)
}