about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rwxr-xr-xleo.pl14
1 files changed, 12 insertions, 2 deletions
diff --git a/leo.pl b/leo.pl
index 92322db..1a12070 100755
--- a/leo.pl
+++ b/leo.pl
@@ -9,6 +9,8 @@ use Path::Tiny;
 use Config::Tiny;
 use Getopt::Long qw/ GetOptions /;
 
+my $version = "leo v0.3.3";
+
 # Options.
 
 my %options = (
@@ -20,9 +22,12 @@ my %options = (
 
 GetOptions(
     \%options,
-    qw{ verbose encrypt sign signify gzip help }
+    qw{ verbose encrypt sign signify gzip help version }
 ) or die "Error in command line arguments\n";
 
+# Print version.
+print $version, "\n" and exit 0 if $options{version};
+
 # Configuration.
 
 my $config_file = $ENV{XDG_CONFIG_HOME} || "$ENV{HOME}/.config";
@@ -71,7 +76,11 @@ my $backup_dir = $options{backup_dir} || "/tmp/backups";
 path($backup_dir)->mkpath; # Create backup directory.
 
 my $gpg_fingerprint = $options{gpg_fingerprint} || "`nil'";
-my @gpg_recipients = split / /, $options{gpg_recipients};
+
+my @gpg_recipients;
+@gpg_recipients = split / /, $options{gpg_recipients}
+    if $options{gpg_recipients};
+
 my $gpg_bin = $options{gpg_bin} || "gpg";
 
 # Print help.
@@ -243,6 +252,7 @@ Profile:};
     print qq{
         Compress with gzip(1)
 
+    --version [$version]
     --verbose
     --help
 };