diff options
author | Andinus <andinus@nand.sh> | 2020-10-08 00:37:01 +0530 |
---|---|---|
committer | Andinus <andinus@nand.sh> | 2020-10-08 00:37:01 +0530 |
commit | 69f17fe584d24a34b6d826780343819bdbcc3ccc (patch) | |
tree | 0cb277874227c467303fe36dcf1c3121672102a6 /leo.pl | |
parent | 574684fca66be90f789e5dbf5fd1a2bacaf84201 (diff) | |
download | leo-69f17fe584d24a34b6d826780343819bdbcc3ccc.tar.gz |
Get $backup_dir from config, format $mday with 2 leading zeros
This will not work with previous configs. But that's fine because I'm the only one using this.
Diffstat (limited to 'leo.pl')
-rwxr-xr-x | leo.pl | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/leo.pl b/leo.pl index fcf3bef..dcb8447 100755 --- a/leo.pl +++ b/leo.pl @@ -19,18 +19,20 @@ GetOptions( qw{ verbose encrypt sign delete help } ) or die "Error in command line arguments\n"; -my $ymd = ymd(); # YYYY-MM-DD. -my $backup_dir = "/tmp/backups/$ymd"; - -path($backup_dir)->mkpath; # Create backup directory. -my $prof; - # Config file for leo. my $config_file = $ENV{XDG_CONFIG_HOME} || "$ENV{HOME}/.config"; $config_file .= "/leo.pl"; require "$config_file"; +my $ymd = ymd(); # YYYY-MM-DD. +my $backup_dir = get_backup_dir() || "/tmp/backups"; +$backup_dir .= "/$ymd"; + +path($backup_dir)->mkpath; # Create backup directory. +my $prof; + + my %profile = get_profile(); my $gpg_fingerprint = get_gpg_fingerprint(); my $gpg_bin = get_gpg_bin(); @@ -145,5 +147,6 @@ sub ymd { my @months = qw( 01 02 03 04 05 06 07 08 09 10 11 12 ); my $month = $months[$mon]; + $mday = sprintf "%02d", $mday; return "$year-$month-$mday"; } |