Remove default values for CLI arguments, all params except -h now required

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Niko 2026-05-05 15:57:25 +08:00
parent 01505285b0
commit 3877d51560

View File

@ -64,23 +64,21 @@ public class EtsScraper {
} }
} }
if (proxyHost == null) { if (proxyHost == null || proxyUser == null || proxyPass == null || dateStr == null) {
proxyHost = "http://127.0.0.1:8081"; System.err.println("[-] Missing required arguments");
} printHelp();
if (proxyUser == null) { return;
proxyUser = "admin"; }
}
if (proxyPass == null) {
proxyPass = "123456";
}
java.time.LocalDate targetDate; java.time.LocalDate targetDate;
if (dateStr != null) { try {
targetDate = java.time.LocalDate.parse(dateStr); targetDate = java.time.LocalDate.parse(dateStr);
} else { } catch (Exception e) {
targetDate = java.time.LocalDate.now().minusDays(1); System.err.println("[-] Invalid date format: " + dateStr + ", expected yyyy-MM-dd");
} return;
}
String dateStrFormatted = targetDate.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd")); String dateStrFormatted = targetDate.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd"));
String dateStrFileName = targetDate.format(DateTimeFormatter.ofPattern("yyyyMMdd")); String dateStrFileName = targetDate.format(DateTimeFormatter.ofPattern("yyyyMMdd"));
try { try {
@ -244,10 +242,10 @@ public class EtsScraper {
用法: java -jar ets-playwright.jar [选项] 用法: java -jar ets-playwright.jar [选项]
选项: 选项:
-s <url> ets-proxy 服务器地址 (默认: http://127.0.0.1:8081) -s <url> ets-proxy 服务器地址
-u <user> ets-proxy 用户名 (默认: admin) -u <user> ets-proxy 用户名
-p <pass> ets-proxy 密码 (默认: 123456) -p <pass> ets-proxy 密码
-d <date> 查询日期格式 yyyy-MM-dd (默认: 昨天) -d <date> 查询日期格式 yyyy-MM-dd
-h 显示此帮助信息 -h 显示此帮助信息
示例: 示例: