mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
pw-dump: always output colors and add option to disable
-N disables colors now. Usually we want to preserve them in debug files and grep etc. Use less -R to get colors See #698
This commit is contained in:
parent
246f7bd77e
commit
90d8589fb9
1 changed files with 10 additions and 6 deletions
|
|
@ -1355,7 +1355,8 @@ static void show_help(struct data *data, const char *name)
|
||||||
" -h, --help Show this help\n"
|
" -h, --help Show this help\n"
|
||||||
" --version Show version\n"
|
" --version Show version\n"
|
||||||
" -r, --remote Remote daemon name\n"
|
" -r, --remote Remote daemon name\n"
|
||||||
" -m, --monitor monitor changes\n",
|
" -m, --monitor monitor changes\n"
|
||||||
|
" -N, --no-colors disable color output\n",
|
||||||
name);
|
name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1370,13 +1371,17 @@ int main(int argc, char *argv[])
|
||||||
{ "version", no_argument, NULL, 'V' },
|
{ "version", no_argument, NULL, 'V' },
|
||||||
{ "remote", required_argument, NULL, 'r' },
|
{ "remote", required_argument, NULL, 'r' },
|
||||||
{ "monitor", no_argument, NULL, 'm' },
|
{ "monitor", no_argument, NULL, 'm' },
|
||||||
|
{ "no-colors", no_argument, NULL, 'N' },
|
||||||
{ NULL, 0, NULL, 0}
|
{ NULL, 0, NULL, 0}
|
||||||
};
|
};
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
pw_init(&argc, &argv);
|
pw_init(&argc, &argv);
|
||||||
|
|
||||||
while ((c = getopt_long(argc, argv, "hVr:m", long_options, NULL)) != -1) {
|
data.out = stdout;
|
||||||
|
colors = true;
|
||||||
|
|
||||||
|
while ((c = getopt_long(argc, argv, "hVr:mN", long_options, NULL)) != -1) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'h' :
|
case 'h' :
|
||||||
show_help(&data, argv[0]);
|
show_help(&data, argv[0]);
|
||||||
|
|
@ -1395,6 +1400,9 @@ int main(int argc, char *argv[])
|
||||||
case 'm' :
|
case 'm' :
|
||||||
data.monitor = true;
|
data.monitor = true;
|
||||||
break;
|
break;
|
||||||
|
case 'N' :
|
||||||
|
colors = false;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
show_help(&data, argv[0]);
|
show_help(&data, argv[0]);
|
||||||
return -1;
|
return -1;
|
||||||
|
|
@ -1415,10 +1423,6 @@ int main(int argc, char *argv[])
|
||||||
pw_loop_add_signal(l, SIGINT, do_quit, &data);
|
pw_loop_add_signal(l, SIGINT, do_quit, &data);
|
||||||
pw_loop_add_signal(l, SIGTERM, do_quit, &data);
|
pw_loop_add_signal(l, SIGTERM, do_quit, &data);
|
||||||
|
|
||||||
data.out = stdout;
|
|
||||||
if (isatty(fileno(data.out)))
|
|
||||||
colors = true;
|
|
||||||
|
|
||||||
data.context = pw_context_new(l, NULL, 0);
|
data.context = pw_context_new(l, NULL, 0);
|
||||||
if (data.context == NULL) {
|
if (data.context == NULL) {
|
||||||
fprintf(stderr, "can't create context: %m\n");
|
fprintf(stderr, "can't create context: %m\n");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue