From 45c5f4f9ccbf70e16791b764aff889b130bf2bc1 Mon Sep 17 00:00:00 2001 From: Ryan Uber Date: Fri, 11 Sep 2015 10:00:55 -0700 Subject: [PATCH] command: adjustments for status --- command/status.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/command/status.go b/command/status.go index e00217628..9454c244a 100644 --- a/command/status.go +++ b/command/status.go @@ -15,10 +15,10 @@ type StatusCommand struct { func (c *StatusCommand) Help() string { helpText := ` -Usage: nomad status [options] +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",