about summary refs log tree commit diff stats
path: root/leo.pl
diff options
context:
space:
mode:
authorAndinus <andinus@nand.sh>2020-08-27 14:40:44 +0530
committerAndinus <andinus@nand.sh>2020-08-27 14:40:44 +0530
commit299d5ee6bedcf3285951caa515ad35c705a85f89 (patch)
tree6af8a396b2b6f2a24f4b601a01e259f2d75c25e1 /leo.pl
parent18c8216959dd817d4b6f0971773174fb6e937af0 (diff)
downloadleo-299d5ee6bedcf3285951caa515ad35c705a85f89.tar.gz
Add delete option
This will remove the archive after running gpg2.
Diffstat (limited to 'leo.pl')
-rwxr-xr-xleo.pl7
1 files changed, 6 insertions, 1 deletions
diff --git a/leo.pl b/leo.pl
index 4790da5..d33604e 100755
--- a/leo.pl
+++ b/leo.pl
@@ -11,7 +11,7 @@ use Getopt::Long qw/ GetOptions /;
 my %options = ();
 GetOptions(
     \%options,
-    qw{ verbose encrypt sign }
+    qw{ verbose encrypt sign delete }
 ) or die "Error in command line arguments\n";
 
 my $gpg_fingerprint = "D9AE4AEEE1F1B3598E81D9DFB67D55D482A799FD";
@@ -85,6 +85,9 @@ sub encrypt_sign() {
     run3 ["gpg2", "--yes", "-o", "$file.gpg", @options, $file];
     warn "[WARN] $file.gpg exists, might overwrite.\n" if -e "$file.gpg";
     say "\nOutput: $file.gpg";
+
+    unlink $file and say "$file deleted."
+        or warn "[WARN] Could not delete $file: $!\n";
 }
 
 sub HelpMessage {
@@ -106,6 +109,8 @@ Options:
         Encrypt files with $gpg_fingerprint
     --sign
         Sign files with $gpg_fingerprint
+    --delete
+        Delete the archive after running gpg2
     --verbose};
 }