Skip to content

Commit fa0a2a1

Browse files
committed
Show URLs in standard view all the time
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
1 parent 376d8bc commit fa0a2a1

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

cmd/jobs.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func makeJobs() *cobra.Command {
3636

3737
cmd.Flags().BoolP("json", "j", false, "Request output in JSON format")
3838

39-
cmd.Flags().BoolP("urls", "u", false, "Include the URLs to the job in the output")
39+
cmd.Flags().BoolP("urls", "u", false, "In verbose mode, control whether to include URLs (URLs always shown in non-verbose mode)")
4040

4141
return cmd
4242
}
@@ -106,7 +106,11 @@ func runJobsE(cmd *cobra.Command, args []string) error {
106106
if err := json.Unmarshal([]byte(res), &statuses); err != nil {
107107
return err
108108
}
109-
printEvents(os.Stdout, statuses, verbose, includeURL)
109+
110+
// In non-verbose mode, always show URLs
111+
// In verbose mode, respect the --urls flag
112+
showURL := !verbose || includeURL
113+
printEvents(os.Stdout, statuses, verbose, showURL)
110114
}
111115

112116
return nil
@@ -117,7 +121,7 @@ func printEvents(w io.Writer, statuses []JobStatus, verbose, includeURL bool) {
117121
tabwriter := tabwriter.NewWriter(w, 0, 0, 1, ' ', tabwriter.TabIndent)
118122
if verbose {
119123

120-
st := "JOB ID\tOWNER\tREPO\tJOB\tRUNNER\tSERVER\tSTATUS\tSTARTED\tAGE\tETA\tLABELS"
124+
st := "JOB ID\tOWNER\tREPO\tJOB\tRUNNER\tSERVER\tSTATUS\tAGE\tETA\tLABELS"
121125
if includeURL {
122126
st = st + "\tURL"
123127
}

0 commit comments

Comments
 (0)