- Jakarta Commons CLI
- コマンドライン引数をパースしてという CLI(Command Line Interface)
- Options: 受け取れるオプション
- addOption で受け取れる引数を追加していく
- parser.parse(options, args)とするとパースした結果を得られる
import org.apache.commons.cli.base.*;
final Options options = new Options();
final Option helpOpt = OptionBuilder
.hasArg(false)
.withArgName("help")
.isRequired(false)
.withDescription("このヘルプ")
.withLongOpt("help")
.create(HELP_OPT);
options.addOption(helpOpt);
final CommandLineParser parser = new BasicParser();
final CommandLine commandLine = null;
try {
commandLine = parser.parse(options, args);
} catch (ParseException e) {
new HelpFormatter().printHelp("homura help", options)
System.exit(1);
}
Pinned Articles
About
ウェブ界隈でエンジニアとして労働活動に励んでいる @gomi_ningen 個人のブログです
Tags
GenAI
JavaScript
PowerShell
fluentd
kibana
elasticsearch
nginx
五十嵐裕美
村川梨衣
イベント
logrotate
IoT
Java
Scala
ICMP
iputils
C言語
WUG
mastodon
AWS
Swift
Clock
Windows
PoEAA
アーキテクチャ
iOS
DeviceFarm
プログラミング言語
OS
StepFunctions
Lambda
Serverless
terraform
ポエム
RHEL
ネットワーク
GraphQL
CloudWatch
Linux
Coreutils
nc
telnet
network
LinuxKernel
fpinscala
ELB
IAM
AppSync
EFS
Gradle