summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2011-07-21 16:53:18 +0200
committerDaniel Friesel <derf@finalrewind.org>2011-07-21 16:53:18 +0200
commitc22143897b300085d7c8ef37e8fe4850a0c2aca2 (patch)
tree0539b1fff555f396aeabb9af4228ce1d6f4b3033 /bin
parent7e948f4248953e135ba9824e15801b313f69c9da (diff)
Make xclip command configurable (->chrome support)
Diffstat (limited to 'bin')
-rwxr-xr-xbin/raps240
1 files changed, 36 insertions, 4 deletions
diff --git a/bin/raps2 b/bin/raps2
index 5aed4c9..0bd8f52 100755
--- a/bin/raps2
+++ b/bin/raps2
@@ -11,7 +11,7 @@ use File::BaseDir qw(data_files data_home);
use File::Slurp qw(read_dir);
use Getopt::Long qw(:config no_ignore_case);
-my ( $default_cost, $no_echo, $paste, $pwgen_cmd );
+my ( $default_cost, $no_echo, $paste, $pwgen_cmd, $xclip_cmd );
our $VERSION = '0.52';
@@ -22,13 +22,15 @@ GetOptions(
'p|pwgen-cmd=s' => \$pwgen_cmd,
'P|paste' => \$paste,
'V|version' => sub { say "raps2 version ${VERSION}"; exit 0 },
+ 'x|xclip-cmd=s' => \$xclip_cmd,
) or cmd_help(1);
my ( $action, @args ) = @ARGV;
my $raps2 = App::Raps2->new(
cost => $default_cost,
- pwgen_cmd => $pwgen_cmd
+ pwgen_cmd => $pwgen_cmd,
+ xclip_cmd => $xclip_cmd,
);
sub file_must_exist {
@@ -81,7 +83,7 @@ sub cmd_add {
}
if ($paste) {
- $raps2->ui->to_clipboard($pass);
+ $raps2->ui->to_clipboard( $pass, $raps2->conf('xclip_cmd') );
}
elsif ( not $no_echo ) {
$raps2->ui->output( [ 'Generated password', $pass ] );
@@ -181,7 +183,7 @@ sub cmd_get {
my $key = $raps2->pw_load( file => $pwfile );
- $raps2->ui->to_clipboard( $key->{password} )
+ $raps2->ui->to_clipboard( $key->{password}, $raps2->conf('xclip_cmd') )
or die("Could not place password in clipboard: ${!}\n");
if ( $key->{extra} ) {
@@ -324,6 +326,8 @@ Decrypt I<account>'s password and store it in the primary X Clipboard. Note
that it can only be pasted once. Prints the content of the multiline B<extra>
field (if present) to stdout.
+See also the B<-x> option.
+
=item B<info> I<account>
Show information about I<account>, does not require the master password.
@@ -378,6 +382,13 @@ Default: pwgen -s 23 1
Show version information.
+=item B<-x>, B<--xclip-cmd> I<command>
+
+Command to run for B<raps2 get>. Set this to C<< xclip -l 2 >> if you are
+using chrome. The password will be available on I<command>'s stdin.
+
+Default: xclip -l 1
+
=back
=head1 EXIT STATUS
@@ -396,6 +407,27 @@ Additional encrypted passwords are stored in F<~/.local/share/raps2/>.
These directories can be changed by setting the B<XDG_CONFIG_HOME> and
B<XDG_DATA_HOME> environment variables.
+The following settings are available in F<~/.config/raps2/defaults>:
+
+=over
+
+=item B<cost> = 12
+
+Default key setup cost. See the B<-c> option.
+
+=item B<pwgen_cmd> = pwgen -s 23 1
+
+Command used to generate passwords. See the B<-p> option.
+
+=item B<xclip_cmd> = xclip -l 1
+
+Command used to place passwords in the clipboard. See the B<-x> option.
+
+=back
+
+Note that commandline arguments always override options set in the
+configuration file.
+
=head1 DEPENDENCIES
=over