diff --git a/pkg/backup.go b/pkg/backup.go index 99c1a41..5021d00 100644 --- a/pkg/backup.go +++ b/pkg/backup.go @@ -154,11 +154,10 @@ func BackupDatabase(disableCompression bool, prune bool, keepLast int) { } utils.Done("Database has been backed up") - //Delete old backup - if prune { - deleteOldBackup(keepLast) - } - + } + //Delete old backup + if prune { + deleteOldBackup(keepLast) } historyFile, err := os.OpenFile(fmt.Sprintf("%s/history.txt", storagePath), os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644) @@ -191,7 +190,7 @@ func deleteOldBackup(keepLast int) { if err != nil { utils.Fatal("Error:", err) } else { - utils.Done("File", filePath, "deleted successfully") + utils.Done("File ", filePath, " deleted successfully") } return err } diff --git a/utils/constant.go b/utils/constant.go index 8b96812..c0d4e92 100644 --- a/utils/constant.go +++ b/utils/constant.go @@ -1,11 +1,5 @@ package utils -const Notice = "Please remove --operation flag.\n" + - "Use: \n" + - "- backup for database backup operation [eg: bkup backup -d database_name ...]\n" + - "- restore for database restore operation [eg. bkup restore -d database_name ...]\n" + - "Example: bkup backup --storage s3 ...( instead of < bkup --operation backup >)\n" + - "We are sorry for this inconvenient\n" const RestoreExample = "pg-bkup restore --dbname database --file db_20231219_022941.sql.gz\n" + "bkup restore --dbname database --storage s3 --path /custom-path --file db_20231219_022941.sql.gz" const BackupExample = "pg-bkup backup --dbname database --disable-compression\n" +