command: adjustments for status

This commit is contained in:
Ryan Uber
2015-09-11 10:00:55 -07:00
parent 314ce4be43
commit 45c5f4f9cc

View File

@@ -15,10 +15,10 @@ type StatusCommand struct {
func (c *StatusCommand) Help() string {
helpText := `
Usage: nomad status [options] <job>
Usage: nomad status [options] [job]
Displays information about the given job. If no job ID
is given, this command will dump a list of all jobs.
Displays information about the given job. If no job ID is given,
a list of all known jobs will be dumped.
Options:
@@ -26,7 +26,8 @@ Options:
Display this message
-http-addr
Address of the Nomad API to connect.
Address of the Nomad API to connect. Can also be specified
using the environment variable NOMAD_HTTP_ADDR.
Default = http://127.0.0.1:4646
`
return strings.TrimSpace(helpText)
@@ -68,6 +69,11 @@ func (c *StatusCommand) Run(args []string) int {
return 1
}
// No output if we have no jobs
if len(jobs) == 0 {
return 0
}
out := []string{"ID|Type|Priority|AllAtOnce|Status"}
for _, job := range jobs {
out = append(out, fmt.Sprintf("%s|%s|%d|%v|%s",