chiark / gitweb /
systemctl: honor --no-legend in 'list-jobs'
authorMantas Mikulėnas <grawity@gmail.com>
Wed, 13 Nov 2013 11:36:18 +0000 (13:36 +0200)
committerDavid Strauss <david@davidstrauss.net>
Wed, 13 Nov 2013 14:17:23 +0000 (00:17 +1000)
src/systemctl/systemctl.c

index 8b6dae27b844876fd09db4cf39225e0393b0aad0..737cd67d6814b12f1706e009bbe58c0f3536b9ae 100644 (file)
@@ -1445,11 +1445,12 @@ static void output_jobs_list(const struct job_info* jobs, unsigned n) {
                 shorten = true;
         }
 
                 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;
 
         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, 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) {
 }
 
 static int list_jobs(sd_bus *bus, char **args) {