diff options
author | Christian Pointner <equinox@helsinki.at> | 2016-07-25 21:22:08 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2016-07-25 21:22:45 (GMT) |
commit | 343ac9e3baec46fef765d7193a92555fea7e288c (patch) | |
tree | ed2c7e6af96d45a06934e2e1c7ad55b9ae2201d5 /utils | |
parent | ca5e48c874c015ce60e43fb5ccf73845fe46b6a2 (diff) |
list groups by type
Diffstat (limited to 'utils')
-rwxr-xr-x | utils/rhrd-group | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/utils/rhrd-group b/utils/rhrd-group index 9d73adb..088bc10 100755 --- a/utils/rhrd-group +++ b/utils/rhrd-group @@ -25,7 +25,7 @@ use RHRD::rddb; sub print_usage { - print STDERR "Usage: rhrd-group list\n" . + print STDERR "Usage: rhrd-group list [ (shows|jingles|pools) ]\n" . " rhrd-group (check|remove|get-members|get-carts|get-reports) <groupname>\n" . " rhrd-group add <groupname> [ <description> ]\n" . " rhrd-group (add-member|remove-member|is-member) <groupname> <user>\n" . @@ -35,9 +35,14 @@ sub print_usage sub list { - my ($ctx) = @_; + my ($ctx, $type) = @_; - my @groups = RHRD::rddb::list_groups($ctx); + if(defined($type) && $type ne "shows" && $type ne "jingles" && $type ne "pools") { + print_usage(); + return 1; + } + + my @groups = RHRD::rddb::list_groups($ctx, $type); if(!defined $groups[0] && defined $groups[1]) { print STDERR "$groups[1]: $groups[2]"; return 1; @@ -242,11 +247,11 @@ my $ret = 0; my ($ctx, $status, $errorstring) = RHRD::rddb::init(); if(defined $ctx) { if($cmd eq "list") { - if($num_args != 1) { + if($num_args < 1 || $num_args > 2) { print_usage(); $ret = 1; } else { - $ret = list($ctx); + $ret = list($ctx, $ARGV[1]); } } elsif($cmd eq "check") { |