App-UpfUtils

 view release on metacpan or  search on metacpan

MANIFEST  view on Meta::CPAN

dist.ini
lib/App/UpfUtils.pm
script/upf-add-delete-user-groups
script/upf-add-group
script/upf-add-user
script/upf-add-user-to-group
script/upf-delete-group
script/upf-delete-user
script/upf-delete-user-from-group
script/upf-get-group
script/upf-get-max-gid
script/upf-get-max-uid
script/upf-get-user
script/upf-get-user-groups
script/upf-group-exists
script/upf-is-member
script/upf-list-groups
script/upf-list-users
script/upf-list-users-and-groups
script/upf-modify-group
script/upf-modify-user

META.json  view on Meta::CPAN

            "Data::Sah::Compiler::perl::TH::array" : "0",
            "Data::Sah::Compiler::perl::TH::bool" : "0",
            "Data::Sah::Compiler::perl::TH::int" : "0",
            "Data::Sah::Compiler::perl::TH::str" : "0",
            "Data::Sah::Filter::perl::Path::expand_tilde_when_on_unix" : "0",
            "Data::Sah::Filter::perl::Path::strip_slashes_when_on_unix" : "0",
            "Perinci::CmdLine::Any" : "0",
            "Perinci::CmdLine::Lite" : "1.827",
            "Sah::Schema::dirname" : "0",
            "Sah::Schema::filename" : "0",
            "Sah::Schema::unix::gid" : "0",
            "Sah::Schema::unix::groupname" : "0",
            "Sah::Schema::unix::uid" : "0",
            "Sah::Schema::unix::username" : "0",
            "Unix::Passwd::File" : "0",
            "perl" : "5.010001"
         }
      },
      "test" : {
         "requires" : {
            "File::Spec" : "0",

META.json  view on Meta::CPAN

            "name" : "GenPericmdScript::delete_user_from_group",
            "version" : "0.422"
         },
         {
            "class" : "Dist::Zilla::Plugin::GenPericmdScript",
            "name" : "GenPericmdScript::get_group",
            "version" : "0.422"
         },
         {
            "class" : "Dist::Zilla::Plugin::GenPericmdScript",
            "name" : "GenPericmdScript::get_max_gid",
            "version" : "0.422"
         },
         {
            "class" : "Dist::Zilla::Plugin::GenPericmdScript",
            "name" : "GenPericmdScript::get_max_uid",
            "version" : "0.422"
         },
         {
            "class" : "Dist::Zilla::Plugin::GenPericmdScript",
            "name" : "GenPericmdScript::get_user",

META.yml  view on Meta::CPAN

  Data::Sah::Compiler::perl::TH::array: '0'
  Data::Sah::Compiler::perl::TH::bool: '0'
  Data::Sah::Compiler::perl::TH::int: '0'
  Data::Sah::Compiler::perl::TH::str: '0'
  Data::Sah::Filter::perl::Path::expand_tilde_when_on_unix: '0'
  Data::Sah::Filter::perl::Path::strip_slashes_when_on_unix: '0'
  Perinci::CmdLine::Any: '0'
  Perinci::CmdLine::Lite: '1.827'
  Sah::Schema::dirname: '0'
  Sah::Schema::filename: '0'
  Sah::Schema::unix::gid: '0'
  Sah::Schema::unix::groupname: '0'
  Sah::Schema::unix::uid: '0'
  Sah::Schema::unix::username: '0'
  Unix::Passwd::File: '0'
  perl: '5.010001'
resources:
  bugtracker: https://rt.cpan.org/Public/Dist/Display.html?Name=App-UpfUtils
  homepage: https://metacpan.org/release/App-UpfUtils
  repository: git://github.com/perlancar/perl-App-UpfUtils.git
version: '0.060'

META.yml  view on Meta::CPAN

    -
      class: Dist::Zilla::Plugin::GenPericmdScript
      name: GenPericmdScript::delete_user_from_group
      version: '0.422'
    -
      class: Dist::Zilla::Plugin::GenPericmdScript
      name: GenPericmdScript::get_group
      version: '0.422'
    -
      class: Dist::Zilla::Plugin::GenPericmdScript
      name: GenPericmdScript::get_max_gid
      version: '0.422'
    -
      class: Dist::Zilla::Plugin::GenPericmdScript
      name: GenPericmdScript::get_max_uid
      version: '0.422'
    -
      class: Dist::Zilla::Plugin::GenPericmdScript
      name: GenPericmdScript::get_user
      version: '0.422'
    -

Makefile.PL  view on Meta::CPAN

  "DISTNAME" => "App-UpfUtils",
  "EXE_FILES" => [
    "script/upf-add-delete-user-groups",
    "script/upf-add-group",
    "script/upf-add-user",
    "script/upf-add-user-to-group",
    "script/upf-delete-group",
    "script/upf-delete-user",
    "script/upf-delete-user-from-group",
    "script/upf-get-group",
    "script/upf-get-max-gid",
    "script/upf-get-max-uid",
    "script/upf-get-user",
    "script/upf-get-user-groups",
    "script/upf-group-exists",
    "script/upf-is-member",
    "script/upf-list-groups",
    "script/upf-list-users",
    "script/upf-list-users-and-groups",
    "script/upf-modify-group",
    "script/upf-modify-user",

Makefile.PL  view on Meta::CPAN

    "Data::Sah::Compiler::perl::TH::array" => 0,
    "Data::Sah::Compiler::perl::TH::bool" => 0,
    "Data::Sah::Compiler::perl::TH::int" => 0,
    "Data::Sah::Compiler::perl::TH::str" => 0,
    "Data::Sah::Filter::perl::Path::expand_tilde_when_on_unix" => 0,
    "Data::Sah::Filter::perl::Path::strip_slashes_when_on_unix" => 0,
    "Perinci::CmdLine::Any" => 0,
    "Perinci::CmdLine::Lite" => "1.827",
    "Sah::Schema::dirname" => 0,
    "Sah::Schema::filename" => 0,
    "Sah::Schema::unix::gid" => 0,
    "Sah::Schema::unix::groupname" => 0,
    "Sah::Schema::unix::uid" => 0,
    "Sah::Schema::unix::username" => 0,
    "Unix::Passwd::File" => 0
  },
  "TEST_REQUIRES" => {
    "File::Spec" => 0,
    "IO::Handle" => 0,
    "IPC::Open3" => 0,
    "Test::More" => 0

Makefile.PL  view on Meta::CPAN

  "Data::Sah::Compiler::perl::TH::str" => 0,
  "Data::Sah::Filter::perl::Path::expand_tilde_when_on_unix" => 0,
  "Data::Sah::Filter::perl::Path::strip_slashes_when_on_unix" => 0,
  "File::Spec" => 0,
  "IO::Handle" => 0,
  "IPC::Open3" => 0,
  "Perinci::CmdLine::Any" => 0,
  "Perinci::CmdLine::Lite" => "1.827",
  "Sah::Schema::dirname" => 0,
  "Sah::Schema::filename" => 0,
  "Sah::Schema::unix::gid" => 0,
  "Sah::Schema::unix::groupname" => 0,
  "Sah::Schema::unix::uid" => 0,
  "Sah::Schema::unix::username" => 0,
  "Test::More" => 0,
  "Unix::Passwd::File" => 0
);


unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) {
  delete $WriteMakefileArgs{TEST_REQUIRES};

dist.ini  view on Meta::CPAN

name=upf-delete-user-from-group
read_config=0
read_env=0

[GenPericmdScript/GenPericmdScript::get_group]
url=/Unix/Passwd/File/get_group
name=upf-get-group
read_config=0
read_env=0

[GenPericmdScript/GenPericmdScript::get_max_gid]
url=/Unix/Passwd/File/get_max_gid
name=upf-get-max-gid
read_config=0
read_env=0

[GenPericmdScript/GenPericmdScript::get_max_uid]
url=/Unix/Passwd/File/get_max_uid
name=upf-get-max-uid
read_config=0
read_env=0

[GenPericmdScript/GenPericmdScript::get_user]

script/upf-add-group  view on Meta::CPAN

upf-add-group - Add a new group

=head1 VERSION

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

=head1 SYNOPSIS

Usage:

 % upf-add-group [--backup] [--etc-dir=s] [--format=name] [--gid=s]
     [--json] [--max-gid=s] [--members-json=s] [--members=s] [--min-gid=s]
     [--(no)naked-res] [--no-backup] [--nobackup] [--page-result[=program]]
     <group>

=head1 OPTIONS

C<*> marks required options.

=head2 Main options

=over

=item B<--backup>

Whether to backup when modifying files.

Backup is written with `.bak` extension in the same directory. Unmodified file
will not be backed up. Previous backup will be overwritten.


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

Pick a specific new GID.

Adding a new group with duplicate GID is allowed.


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

=item B<--max-gid>=I<s>

Pick a range for new GID.

Default value:

 65535

If a free GID between `min_gid` and `max_gid` is not found, error 412 is
returned.


=item B<--members-json>=I<s>

Fill initial members (JSON-encoded).

See C<--members>.

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

Fill initial members.

=item B<--min-gid>=I<s>

Pick a range for new GID.

Default value:

 1000

If a free GID between `min_gid` and `max_gid` is not found, error 412 is
returned.


=back

=head2 Output options

=over

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

script/upf-add-user  view on Meta::CPAN


=head1 VERSION

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

=head1 SYNOPSIS

Usage:

 % upf-add-user [--backup] [--encpass=s] [--etc-dir=s] [--expire-date=s]
     [--format=name] [--gecos=s] [--gid=s] [--group=s] [--home=s] [--json]
     [--last-pwchange=s] [--max-gid=s] [--max-pass-age=s] [--max-uid=s]
     [--min-gid=s] [--min-pass-age=s] [--min-uid=s] [--(no)naked-res]
     [--no-backup] [--nobackup] [--page-result[=program]]
     [--pass-inactive-period=s] [--pass-warn-period=s] [--pass=s]
     [--shell=s] [--uid=s] <user>

=head1 OPTIONS

C<*> marks required options.

=head2 Main options

script/upf-add-user  view on Meta::CPAN

Encrypted password.

=item B<--expire-date>=I<s>

The date of expiration of the account, expressed as the number of days since Jan 1, 1970.

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

Usually, it contains the full username.

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

Pick a specific GID when creating group.

Duplicate GID is allowed.


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

Select primary group (default is group with same name as user).

script/upf-add-user  view on Meta::CPAN



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

User's home directory.

=item B<--last-pwchange>=I<s>

The date of the last password change, expressed as the number of days since Jan 1, 1970..

=item B<--max-gid>=I<s>

Pick a range for GID when creating group.

=item B<--max-pass-age>=I<s>

The number of days after which the user will have to change her password.

=item B<--max-uid>=I<s>

Pick a range for new UID.

Default value:

 65535

If a free UID between `min_uid` and `max_uid` is not found, error 412 is
returned.


=item B<--min-gid>=I<s>

Pick a range for GID when creating group.

=item B<--min-pass-age>=I<s>

The number of days the user will have to wait before she will be allowed to change her password again.

=item B<--min-uid>=I<s>

Pick a range for new UID.

script/upf-get-group  view on Meta::CPAN


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

$cmdline->run;

# ABSTRACT: Get group details by group name or gid
# PODNAME: upf-get-group

__END__

=pod

=encoding UTF-8

=head1 NAME

upf-get-group - Get group details by group name or gid

=head1 VERSION

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

=head1 SYNOPSIS

Usage:

 % upf-get-group [--etc-dir=s] [--format=name] [--gid=s] [--group=s]
     [--json] [--(no)naked-res] [--page-result[=program]]
     [--with-field-names] [--without-field-names]

=head1 DESCRIPTION

Either C<group> OR C<gid> must be specified.

The function is not dissimilar to Unix's C<getgrnam()> or C<getgrgid()>.

=head1 OPTIONS

C<*> marks required options.

=head2 Main options

=over

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

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

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

By default, a hashref is returned 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>

script/upf-get-max-gid  view on Meta::CPAN

#!perl

# Note: This script is a CLI for Riap function /Unix/Passwd/File/get_max_gid
# and generated automatically using Perinci::CmdLine::Gen version 0.496

our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
our $DATE = '2020-04-29'; # DATE
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_max_gid",
    program_name => "upf-get-max-gid",
    read_config => 0,
    read_env => 0,
);

$cmdline->run;

# ABSTRACT: Get maximum GID used
# PODNAME: upf-get-max-gid

__END__

=pod

=encoding UTF-8

=head1 NAME

upf-get-max-gid - Get maximum GID used

=head1 VERSION

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

=head1 SYNOPSIS

Usage:

 % upf-get-max-gid [--etc-dir=s] [--format=name] [--json] [--(no)naked-res]
     [--page-result[=program]]

=head1 OPTIONS

C<*> marks required options.

=head2 Output options

=over

script/upf-get-max-gid  view on Meta::CPAN


=head1 COMPLETION

This script has shell tab completion capability with support for several
shells.

=head2 bash

To activate bash completion for this script, put:

 complete -C upf-get-max-gid upf-get-max-gid

in your bash startup (e.g. F<~/.bashrc>). Your next shell session will then
recognize tab completion for the command. Or, you can also directly execute the
line above in your shell to activate immediately.

It is recommended, however, that you install modules using L<cpanm-shcompgen>
which can activate shell completion for scripts immediately.

=head2 tcsh

To activate tcsh completion for this script, put:

 complete upf-get-max-gid 'p/*/`upf-get-max-gid`/'

in your tcsh startup (e.g. F<~/.tcshrc>). Your next shell session will then
recognize tab completion for the command. Or, you can also directly execute the
line above in your shell to activate immediately.

It is also recommended to install L<shcompgen> (see above).

=head2 other shells

For fish and zsh, install L<shcompgen> as described above.

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


=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

script/upf-group-exists  view on Meta::CPAN

upf-group-exists - Check whether group exists

=head1 VERSION

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

=head1 SYNOPSIS

Usage:

 % upf-group-exists [--etc-dir=s] [--format=name] [--gid=s] [--group=s]
     [--json] [--(no)naked-res] [--page-result[=program]]

=head1 OPTIONS

C<*> marks required options.

=head2 Main options

=over

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

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

=back

=head2 Output options

=over

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

script/upf-list-groups  view on Meta::CPAN


=over

=item B<--detail>

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

=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

script/upf-modify-group  view on Meta::CPAN


=head1 VERSION

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

=head1 SYNOPSIS

Usage:

 % upf-modify-group [--admins=s] [--backup] [--encpass=s] [--etc-dir=s]
     [--format=name] [--gid=s] [--json] [--members=s] [--(no)naked-res]
     [--no-backup] [--nobackup] [--page-result[=program]] [--pass=s]
     <group>

=head1 DESCRIPTION

Specify arguments to modify corresponding fields. Unspecified fields will not be
modified.

=head1 OPTIONS

script/upf-modify-group  view on Meta::CPAN

Whether to backup when modifying files.

Backup is written with `.bak` extension in the same directory. Unmodified file
will not be backed up. Previous backup will be overwritten.


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

Encrypted password.

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

Numeric group ID.

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

Group name.

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

List of usernames that are members of this group, separated by commas.

script/upf-modify-user  view on Meta::CPAN


=head1 VERSION

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

=head1 SYNOPSIS

Usage:

 % upf-modify-user [--backup] [--encpass=s] [--etc-dir=s] [--expire-date=s]
     [--format=name] [--gecos=s] [--gid=s] [--home=s] [--json]
     [--last-pwchange=s] [--max-pass-age=s] [--min-pass-age=s]
     [--(no)naked-res] [--no-backup] [--nobackup] [--page-result[=program]]
     [--pass-inactive-period=s] [--pass-warn-period=s] [--shell=s]
     [--uid=s] <user>

=head1 DESCRIPTION

Specify arguments to modify corresponding fields. Unspecified fields will not be
modified.

script/upf-modify-user  view on Meta::CPAN

Encrypted password.

=item B<--expire-date>=I<s>

The date of expiration of the account, expressed as the number of days since Jan 1, 1970.

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

Usually, it contains the full username.

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

Numeric primary group ID for this user.

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

User's home directory.

=item B<--last-pwchange>=I<s>

The date of the last password change, expressed as the number of days since Jan 1, 1970..

t/00-compile.t  view on Meta::CPAN


my @scripts = (
    'script/upf-add-delete-user-groups',
    'script/upf-add-group',
    'script/upf-add-user',
    'script/upf-add-user-to-group',
    'script/upf-delete-group',
    'script/upf-delete-user',
    'script/upf-delete-user-from-group',
    'script/upf-get-group',
    'script/upf-get-max-gid',
    'script/upf-get-max-uid',
    'script/upf-get-user',
    'script/upf-get-user-groups',
    'script/upf-group-exists',
    'script/upf-is-member',
    'script/upf-list-groups',
    'script/upf-list-users',
    'script/upf-list-users-and-groups',
    'script/upf-modify-group',
    'script/upf-modify-user',

t/author-critic.t  view on Meta::CPAN

}


use strict;
use warnings;

# this test was generated with Dist::Zilla::Plugin::Test::Perl::Critic::Subset 3.001.005

use Test::Perl::Critic (-profile => "") x!! -e "";

my $filenames = ['lib/App/UpfUtils.pm','script/upf-add-delete-user-groups','script/upf-add-group','script/upf-add-user','script/upf-add-user-to-group','script/upf-delete-group','script/upf-delete-user','script/upf-delete-user-from-group','script/upf-...
unless ($filenames && @$filenames) {
    $filenames = -d "blib" ? ["blib"] : ["lib"];
}

all_critic_ok(@$filenames);



( run in 2.760 seconds using v1.01-cache-2.11-cpan-ceb78f64989 )