App-UpfUtils

 view release on metacpan or  search on metacpan

script/upf-get-user-groups  view on Meta::CPAN

our $DIST = 'App-UpfUtils'; # DIST
our $VERSION = '0.060'; # VERSION

use 5.010001;
use strict;
use warnings;

use Perinci::CmdLine::Any;

my $cmdline = Perinci::CmdLine::Any->new(
    url => "/Unix/Passwd/File/get_user_groups",
    program_name => "upf-get-user-groups",
    read_config => 0,
    read_env => 0,
);

$cmdline->run;

# ABSTRACT: Return groups which the user belongs to
# PODNAME: upf-get-user-groups

__END__

=pod

=encoding UTF-8

=head1 NAME

upf-get-user-groups - Return groups which the user belongs to

=head1 VERSION

This document describes version 0.060 of upf-get-user-groups (from Perl distribution App-UpfUtils), released on 2020-04-29.

=head1 SYNOPSIS

Usage:

 % upf-get-user-groups [--detail] [--etc-dir=s] [--format=name] [--json]
     [--(no)naked-res] [--no-detail] [--nodetail] [--page-result[=program]]
     [--with-field-names] [--without-field-names] <user>

=head1 OPTIONS

C<*> marks required options.

=head2 Main options

=over

=item B<--detail>

If true, return all fields instead of just group names.

=item B<--user>=I<s>*

=item B<--without-field-names>

By default, when `detail=>1`, a hashref is returned for each entry containing
field names and its values, e.g. `{group=>"titin", pass=>"x", gid=>500, ...}`.
With `with_field_names=>0`, an arrayref is returned instead: `["titin", "x",
500, ...]`.


=back

=head2 Output options

=over

=item B<--format>=I<s>

Choose output format, e.g. json, text.

Default value:

 undef

=item B<--json>

Set output format to json.

=item B<--naked-res>

When outputing as JSON, strip result envelope.

Default value:

 0

By default, when outputing as JSON, the full enveloped result is returned, e.g.:

    [200,"OK",[1,2,3],{"func.extra"=>4}]

The reason is so you can get the status (1st element), status message (2nd
element) as well as result metadata/extra result (4th element) instead of just
the result (3rd element). However, sometimes you want just the result, e.g. when
you want to pipe the result for more post-processing. In this case you can use
`--naked-res` so you just get:

    [1,2,3]


=item B<--page-result>

Filter output through a pager.

=back

=head2 Other options

=over

=item B<--etc-dir>=I<s>

Specify location of passwd files.

Default value:

 "/etc"



( run in 0.471 second using v1.01-cache-2.11-cpan-ceb78f64989 )