Hetula-Client

 view release on metacpan or  search on metacpan

bin/hetula-client  view on Meta::CPAN

#!/usr/bin/env perl

our $VERSION = '0.008';

# Copyright 2018 National Library of Finland
# This file is part of Hetula.
#
# Hetula is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# Hetula is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You find a copy of the GNU General Public License
# here <http://www.gnu.org/licenses>.

use Modern::Perl;
use feature qw(signatures);
no warnings qw(experimental::signatures);

use Getopt::Long;
use Hetula::Client;
use Data::Printer;

use IO::Prompter {
  prompt_password => [-timeout=>120, -echo=>'*'],
  prompt_string   => [-timeout=>120],
};


my %args;
Getopt::Long::GetOptions(
  'a|action:s'          => \$args{action},
  'c|credentials:s'     => \$args{credentials},
  'l|list'              => \$args{listActions},
  'o|organization:s'    => \$args{organization},
  'p|password:s'        => \$args{password},
  'u|username:s'        => \$args{username},
  'url=s'               => \$args{baseURL},
  'a|action:s'          => \$args{action},
  'version'             => sub { Getopt::Long::VersionMessage() },
  'h|help'              => sub {
  print <<HELP;

NAME
  $0 - Interface with Hetula

SYNOPSIS
Does things to Hetula.

DESCRIPTION
If you have problems with the SSL certificate not being accepted, you can
bypass some of Mojolicious' checks with
  MOJO_INSECURE=1

For more information, see
  perldoc Hetula::Client

  -a --action String
      Instead of using the built-in menu, trigger a single action from the
      commandline.
      Give the action name with the necessary parameters,
      eg. ssnsBatchAddFromFile(/tmp/ssns.txt,/tmp/ssns.results.txt)
          userDisableAccount(username)

  -c --credentials File
      Where to read the username and password, is more secure than passing them
      as commandline arguments directly.
      These credentials overload any other parameters given.
      The credentials file must consist of up to 4 lines, with each line
      specifying the following commandline argument replacements:
        username
        password
        organization
        url

  -l --list



( run in 2.303 seconds using v1.01-cache-2.11-cpan-75ffa21a3d4 )