From 502d16d247c10b33b86b9fa8bbc389f88e8f47c5 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 20 Jul 2011 20:04:39 +0200 Subject: raps2: Add cost/echo/pwgen options --- bin/raps2 | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'bin') diff --git a/bin/raps2 b/bin/raps2 index 90d094f..2451e6f 100755 --- a/bin/raps2 +++ b/bin/raps2 @@ -11,17 +11,25 @@ use File::BaseDir qw(data_files data_home); use File::Slurp qw(read_dir); use Getopt::Long qw(:config no_ignore_case); -my $raps2 = App::Raps2->new(); -my ( $action, @args ) = @ARGV; +my ( $default_cost, $echo_generated, $pwgen_cmd ); our $VERSION = '0.50'; GetOptions( - 'h|help' => sub { cmd_help(0) }, - 'V|version' => sub { say "raps2 version ${VERSION}"; exit 0 }, + 'c|cost=i' => \$default_cost, + 'e|echo' => \$echo_generated, + 'h|help' => sub { cmd_help(0) }, + 'p|pwgen_cmd=s' => \$pwgen_cmd, + 'V|version' => sub { say "raps2 version ${VERSION}"; exit 0 }, ) or cmd_help(1); +my ( $action, @args ) = @ARGV; +my $raps2 = App::Raps2->new( + cost => $default_cost, + pwgen_cmd => $pwgen_cmd +); + sub file_must_exist { my ( $file, $name ) = @_; @@ -70,6 +78,10 @@ sub cmd_add { . $raps2->conf('pwgen_cmd'); exit 3; } + + if ($echo_generated) { + $raps2->ui->output( [ 'Generated password', $pass ] ); + } } $raps2->pw_save( -- cgit v1.2.3