From 6e3b0be2e3a93216943567348f12eb2e7756c4e0 Mon Sep 17 00:00:00 2001 From: "Christian P. MOMON" Date: Sun, 25 Apr 2021 13:18:39 +0200 Subject: [PATCH] Improved archive dry cli. --- src/org/april/logar/cli/LogarCLI.java | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/org/april/logar/cli/LogarCLI.java b/src/org/april/logar/cli/LogarCLI.java index 3d0003b..c9bc923 100644 --- a/src/org/april/logar/cli/LogarCLI.java +++ b/src/org/april/logar/cli/LogarCLI.java @@ -55,13 +55,12 @@ public final class LogarCLI message.appendln("Usage:"); message.appendln(" logar [ -h | -help | --help ]"); message.appendln(" logar [ -v | -version | --version ]"); - message.appendln(" logar anonymize fileordirectory [mapfile] anonymize ip and user"); - message.appendln(" logar archive source target archive previous month from /var/log/nginx/ tree"); - message.appendln(" logar check fileordirectory check line format in log file"); - message.appendln(" logar checksort fileordirectory check sort in log file"); - message.appendln(" logar sort fileordirectory sort log files by datetime"); - message.appendln(" logar testarchive source test archive without writing"); - message.appendln(" logar testconcate fileordirectory test line concate in log file"); + message.appendln(" logar anonymize fileordirectory [mapfile] anonymize ip and user"); + message.appendln(" logar archive [-dry] source target archive previous month from /var/log/nginx/ tree"); + message.appendln(" logar check fileordirectory check line format in log file"); + message.appendln(" logar checksort fileordirectory check sort in log file"); + message.appendln(" logar sort fileordirectory sort log files by datetime"); + message.appendln(" logar testconcate fileordirectory test line concate in log file"); logger.info(message.toString()); } @@ -205,6 +204,13 @@ public final class LogarCLI Logar.archive(source, target, DryOption.OFF); } + else if (isMatching(args, "archive", "-dry", "\\s*\\S+\\s*", "\\s*\\S+\\s*")) + { + File source = new File(args[2]); + File target = new File(args[3]); + + Logar.archive(source, target, DryOption.ON); + } else if (isMatching(args, "check", "\\s*\\S+\\s*")) { File source = new File(args[1]); @@ -223,13 +229,6 @@ public final class LogarCLI Logar.sort(source); } - else if (isMatching(args, "testarchive", "\\s*\\S+\\s*", "\\s*\\S+\\s*")) - { - File source = new File(args[1]); - File target = new File(args[2]); - - Logar.archive(source, target, DryOption.ON); - } else if (isMatching(args, "testconcate", "\\s*\\S+\\s*")) { File source = new File(args[1]);