From 3f39edacf9dab4390e0f82a6b11b52ef1d7a818e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E6=A0=A9=E5=BD=AC?= Date: Tue, 30 Jul 2019 16:38:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=91=BD=E4=BB=A4=E5=8F=82?= =?UTF-8?q?=E6=95=B0,=E6=96=87=E4=BB=B6=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 8 ++++++ src/main/java/fyan/FyanApplication.java | 16 ++++++----- src/main/java/fyan/base/Base.java | 2 -- src/main/java/fyan/cmd_sys/Help.java | 35 ++++++++++--------------- src/main/java/fyan/cmd_sys/Version.java | 2 +- 5 files changed, 32 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 76450f5..f23da0c 100644 --- a/README.md +++ b/README.md @@ -55,4 +55,12 @@ Java version must be greater than 1.8 -d | --download [文件名] url链接下载文件 ``` +#### 其它 +```cmd + -h | --help 命令帮助 + + -v | --version 版本 +``` + + diff --git a/src/main/java/fyan/FyanApplication.java b/src/main/java/fyan/FyanApplication.java index dc04eb2..9ec1002 100644 --- a/src/main/java/fyan/FyanApplication.java +++ b/src/main/java/fyan/FyanApplication.java @@ -25,12 +25,14 @@ package fyan; import fyan.base.Base; +import fyan.cmd_down.Down; import fyan.cmd_secr.*; import fyan.cmd_file.Append; import fyan.cmd_file.Create; import fyan.cmd_file.Replace; import fyan.cmd_file.Substr; import fyan.cmd_sys.Help; +import fyan.cmd_sys.Version; import static fyan.base.Base.primList; @@ -46,9 +48,13 @@ public class FyanApplication { primList.put("-r", Replace.class); primList.put("--replace", Replace.class); primList.put("-a", Append.class); - primList.put("-append", Append.class); + primList.put("--append", Append.class); primList.put("-f", Fingerprint.class); - primList.put("--finger", Fingerprint.class); + primList.put("-finger", Fingerprint.class); + primList.put("-d", Down.class); + primList.put("-down", Down.class); + primList.put("-v", Version.class); + primList.put("--version", Version.class); } public static String LOCAL_PATH; @@ -56,13 +62,9 @@ public class FyanApplication { public static void main(String[] args) { - for (String s : args) - System.out.println(s); - - System.out.println(args.length); LOCAL_PATH = args[0] + "\\"; String[] command; - if (args.length>=2&&"grep".equals(args[args.length - 2])) { + if (args.length >= 2 && "grep".equals(args[args.length - 2])) { REGEX = args[args.length - 1]; command = new String[args.length - 3]; } else diff --git a/src/main/java/fyan/base/Base.java b/src/main/java/fyan/base/Base.java index b3ef33b..89a4f33 100644 --- a/src/main/java/fyan/base/Base.java +++ b/src/main/java/fyan/base/Base.java @@ -36,7 +36,6 @@ public class Base { public static void handle(String[] args) { - System.out.println(args.length); try { Class filterClass; if (args.length == 0) @@ -44,7 +43,6 @@ public static void handle(String[] args) { else filterClass = primList.get(args[0]); CommandBase filterBase = (CommandBase) filterClass.newInstance(); int resCode = filterBase.resInfo(args); - System.out.print("\n"+(resCode == 0 ? "success" : (resCode == -1 ? "fault" : "warning"))); } catch (Exception e) { System.out.print("\t命令或参数错误, -help 查看命令详细"); } finally { diff --git a/src/main/java/fyan/cmd_sys/Help.java b/src/main/java/fyan/cmd_sys/Help.java index 6656627..d977a5c 100644 --- a/src/main/java/fyan/cmd_sys/Help.java +++ b/src/main/java/fyan/cmd_sys/Help.java @@ -30,32 +30,25 @@ public class Help implements CommandBase { public int resInfo(String[] args) { - System.out.print( "\t-h 或 -help \n" + - "\t\t显示命令使用帮助\n" + + System.out.print( "\t -a | --append [pre/suf] 修改文件前缀或后缀\n" + + "\t \n" + + "\t -c | --create [total] [进值+步长+位数] 创建及命名文件夹\n" + + "\t \n" + + "\t -c | --create -l [dictionaryName...] 创建文件夹以常量的方式\n" + + "\t \n" + + "\t -r | --replace [regex] [replacement] 正则修改文件名\n" + + "\t \n" + + "\t -s | --Substr [endIndex] 截取文件名\n" + "\n" + - "\t| grep <正则表达式>\n" + - "\t\t以下所有命令尾部都可加上此命令做正则筛选\n" + + "\t -f | --finger 以指定算法计算文件摘要\n" + "\n" + - "\t| limit <个数> \n" + - "\t\t以下所有命令尾部都可加上此命令做指定个数选择\n" + + "\t -f | --finger -c|--compared 对比摘要,文件防篡改\n" + "\n" + - "\t-c or -create <文件夹个数> [命名规则](默认以数字从0开始) \n" + - "\t\t批量创建文件夹。命名规则:{常量}[变量][进值][位数]\n" + + "\t -d | --download [文件名] url链接下载文件\n" + "\n" + - "\t-m or -modify [pre/suf] [命名规则](默认以数字从0开始) \n" + - "\t\t批量修改文件名前缀或后缀。\n" + + "\t -h | --help 命令帮助\n" + "\n" + - "\t-s or -substring [endIndex] \n" + - "\t\t切割文件名,删掉指定文件名字符索引段。endIndex缺省文件名长度\n" + - "\n" + - "\t-r or -replace [regex] [replacement] \n" + - "\t\t切割文件名,删掉指定文件名字符索引段。endIndex缺省文件名长度\n" + - "\n" + - "\t-lc or -lower [regex] [replacement] \n" + - "\t\t文件名转小写\n" + - "\t\t\n" + - "\t-uc or -up [regex] [replacement] \n" + - "\t\t文件名转大写"); + "\t -v | --version 版本"); return 0; } } diff --git a/src/main/java/fyan/cmd_sys/Version.java b/src/main/java/fyan/cmd_sys/Version.java index 6bf208e..ac6e662 100644 --- a/src/main/java/fyan/cmd_sys/Version.java +++ b/src/main/java/fyan/cmd_sys/Version.java @@ -32,7 +32,7 @@ public int resInfo(String[] args) { System.out.print("Welcome to the folder processing tool from yanyan.site\n" + "Version 1.1.0\n" + - "Java version must be greater than 1.8"); + "Java version must be greater than 1.8\n"); return 0; } }