diff options
author | Mantas Mikulėnas <grawity@gmail.com> | 2013-11-13 13:36:18 +0200 |
---|---|---|
committer | David Strauss <david@davidstrauss.net> | 2013-11-14 00:17:23 +1000 |
commit | 6ce774fd8068d291e85b94bc630358ce86491b36 (patch) | |
tree | f3d408a0953fcf194413ba37cd430bbbf9f0860c /src/systemctl/systemctl.c | |
parent | 6aad7f2cd75c88f990c7857bb173b3e8d0faee0f (diff) |
systemctl: honor --no-legend in 'list-jobs'
Diffstat (limited to 'src/systemctl/systemctl.c')
-rw-r--r-- | src/systemctl/systemctl.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index 8b6dae27b8..737cd67d68 100644 --- a/src/systemctl/systemctl.c +++ b/src/systemctl/systemctl.c @@ -1445,11 +1445,12 @@ static void output_jobs_list(const struct job_info* jobs, unsigned n) { shorten = true; } - printf("%*s %-*s %-*s %-*s\n", - id_len, "JOB", - unit_len, "UNIT", - type_len, "TYPE", - state_len, "STATE"); + if (!arg_no_legend) + printf("%*s %-*s %-*s %-*s\n", + id_len, "JOB", + unit_len, "UNIT", + type_len, "TYPE", + state_len, "STATE"); for (j = jobs; j < jobs + n; j++) { _cleanup_free_ char *e = NULL; @@ -1468,10 +1469,12 @@ static void output_jobs_list(const struct job_info* jobs, unsigned n) { on, state_len, j->state, off); } - on = ansi_highlight(); - off = ansi_highlight_off(); + if (!arg_no_legend) { + on = ansi_highlight(); + off = ansi_highlight_off(); - printf("\n%s%u jobs listed%s.\n", on, n, off); + printf("\n%s%u jobs listed%s.\n", on, n, off); + } } static int list_jobs(sd_bus *bus, char **args) { |