File: otptool

package info (click to toggle)
libpass-otp-perl 1.801-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 116 kB
  • sloc: perl: 141; makefile: 7
file content (52 lines) | stat: -rwxr-xr-x 925 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/perl

=head1 NAME

otptool - one-time password tool

=head1 SYNOPSIS

otptool otpauth://...

=cut

use utf8;
use strict;
use warnings;
use open qw(:std :utf8);

use Getopt::Long;
use Pod::Usage;
use Pass::OTP qw(otp);
use Pass::OTP::URI qw(parse);

our $VERSION = $Pass::OTP::VERSION;

Getopt::Long::Configure(qw(auto_version));
GetOptions(
    'help|h|?' => sub { pod2usage(-verbose => 2) },
) || pod2usage(2);

pod2usage(2) if @ARGV == 0;
pod2usage(2) if $ARGV[0] !~ m#^otpauth://#;
printf("%s\n", otp(parse($ARGV[0])));
exit 0;

__END__
=head1 SEE ALSO

L<Pass::OTP>

L<oathtool(1)>

=head1 COPYRIGHT AND LICENSE

Copyright (C) 2020 Jan Baier

This program is free software; you can redistribute it and/or modify it
under the terms of either: the GNU General Public License as published
by the Free Software Foundation; or the Artistic License.

See L<http://dev.perl.org/licenses/> for more information.

=cut