add username search

This commit is contained in:
Zane C. B-H 2019-08-22 22:54:04 -05:00
parent cc5277b480
commit 3340354397
1 changed files with 21 additions and 0 deletions

View File

@ -57,6 +57,9 @@ sub help{
-w <wchans> A string search for wait channels.
--wi Invert the wait channel search.
-u <UIDs> A comma seperated list of UIDs or usernames.
--ui Invert the UID/username search.
-z Show zombies procs.
';
@ -94,6 +97,8 @@ my $tty=0;
my $jid=0;
my $jids_string;
my $jids_invert=0;
my $uids_string;
my $uids_invert=0;
# get the commandline options
Getopt::Long::Configure ('no_ignore_case');
@ -132,6 +137,8 @@ GetOptions(
'nc' => \$no_color,
'j=s' => \$jids_string,
'ji' => \$jids_invert,
'u=s' => \$uids_string,
'ui' => \$uids_invert,
);
# print the version info if requested
@ -271,6 +278,20 @@ if ( defined( $time_string ) ){
});
}
#
# handles the UID/username search
#
if ( defined( $uids_string ) ){
my @uids=split(/\,/, $uids_string );
push( @filters, {
type=>'UID',
invert=>$uids_invert,
args=>{
uids=>\@uids,
},
});
}
# XOR common boolean CLI flags
if ( defined( $ENV{NCPS_jid} ) ){
$jid = $jid ^ 1;