clean up options

make sure we can use -v for verbose mode
This commit is contained in:
Wim Taymans 2020-04-02 14:34:02 +02:00
parent 1fd5be7101
commit b87c0a9270
8 changed files with 102 additions and 104 deletions

View file

@ -746,15 +746,15 @@ static void do_quit(void *data, int signal_number)
static void show_help(const char *name)
{
fprintf(stdout, "%s [options]\n"
" -h, --help Show this help\n"
" -v, --version Show version\n"
" -a, --all Show all object types\n"
" -s, --smart Show linked objects only\n"
" -d, --detail Show all object properties\n"
" -r, --remote Remote daemon name\n"
" -o, --output Output file (Default %s)\n",
name,
DEFAULT_DOT_PATH);
" -h, --help Show this help\n"
" --version Show version\n"
" -a, --all Show all object types\n"
" -s, --smart Show linked objects only\n"
" -d, --detail Show all object properties\n"
" -r, --remote Remote daemon name\n"
" -o, --output Output file (Default %s)\n",
name,
DEFAULT_DOT_PATH);
}
int main(int argc, char *argv[])
@ -764,25 +764,25 @@ int main(int argc, char *argv[])
const char *opt_remote = NULL;
const char *dot_path = DEFAULT_DOT_PATH;
static const struct option long_options[] = {
{"help", 0, NULL, 'h'},
{"version", 0, NULL, 'v'},
{"all", 0, NULL, 'a'},
{"smart", 0, NULL, 's'},
{"detail", 0, NULL, 'd'},
{"remote", 1, NULL, 'r'},
{"output", 1, NULL, 'o'},
{NULL, 0, NULL, 0}
{ "help", no_argument, NULL, 'h' },
{ "version", no_argument, NULL, 'V' },
{ "all", no_argument, NULL, 'a' },
{ "smart", no_argument, NULL, 's' },
{ "detail", no_argument, NULL, 'd' },
{ "remote", required_argument, NULL, 'r' },
{ "output", required_argument, NULL, 'o' },
{ NULL, 0, NULL, 0}
};
int c;
pw_init(&argc, &argv);
while ((c = getopt_long(argc, argv, "hvasdr:o:", long_options, NULL)) != -1) {
while ((c = getopt_long(argc, argv, "hVasdr:o:", long_options, NULL)) != -1) {
switch (c) {
case 'h' :
show_help(argv[0]);
return 0;
case 'v' :
case 'V' :
fprintf(stdout, "%s\n"
"Compiled with libpipewire %s\n"
"Linked with libpipewire %s\n",