diff --git a/libraries-3/pom.xml b/libraries-3/pom.xml
index 5a73e19b19..2cfebd57ce 100644
--- a/libraries-3/pom.xml
+++ b/libraries-3/pom.xml
@@ -58,6 +58,11 @@
javase
${qrgen.version}
+
+ com.github.rvesse
+ airline
+ ${airline.version}
+
org.cactoos
cactoos
@@ -82,5 +87,6 @@
2.6.0
0.43
+ 2.7.2
diff --git a/libraries-3/src/main/java/com/baeldung/airline/CommandLine.java b/libraries-3/src/main/java/com/baeldung/airline/CommandLine.java
new file mode 100644
index 0000000000..b4c3fc9b9e
--- /dev/null
+++ b/libraries-3/src/main/java/com/baeldung/airline/CommandLine.java
@@ -0,0 +1,17 @@
+package com.baeldung.airline;
+
+import com.github.rvesse.airline.annotations.Cli;
+import com.github.rvesse.airline.help.Help;
+
+@Cli(name = "baeldung-cli",
+description = "Baeldung Airline Tutorial",
+defaultCommand = Help.class,
+commands = { DatabaseSetupCommand.class, LoggingCommand.class, Help.class })
+public class CommandLine {
+
+ public static void main(String[] args) {
+ com.github.rvesse.airline.Cli cli = new com.github.rvesse.airline.Cli<>(CommandLine.class);
+ Runnable cmd = cli.parse(args);
+ cmd.run();
+ }
+}
diff --git a/libraries-3/src/main/java/com/baeldung/airline/DatabaseSetupCommand.java b/libraries-3/src/main/java/com/baeldung/airline/DatabaseSetupCommand.java
new file mode 100644
index 0000000000..bf67fa33b6
--- /dev/null
+++ b/libraries-3/src/main/java/com/baeldung/airline/DatabaseSetupCommand.java
@@ -0,0 +1,77 @@
+package com.baeldung.airline;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.inject.Inject;
+
+import com.github.rvesse.airline.HelpOption;
+import com.github.rvesse.airline.annotations.Command;
+import com.github.rvesse.airline.annotations.Option;
+import com.github.rvesse.airline.annotations.OptionType;
+import com.github.rvesse.airline.annotations.restrictions.AllowedRawValues;
+import com.github.rvesse.airline.annotations.restrictions.MutuallyExclusiveWith;
+import com.github.rvesse.airline.annotations.restrictions.Pattern;
+import com.github.rvesse.airline.annotations.restrictions.RequiredOnlyIf;
+
+@Command(name = "setup-db", description = "Setup our database")
+public class DatabaseSetupCommand implements Runnable {
+ @Inject
+ private HelpOption help;
+
+ @Option(type = OptionType.COMMAND,
+ name = {"-d", "--database"},
+ description = "Type of RDBMS.",
+ title = "RDBMS type: mysql|postgresql|mongodb")
+ @AllowedRawValues(allowedValues = { "mysql", "postgres", "mongodb" })
+ protected String rdbmsMode = "mysql";
+
+ @Option(type = OptionType.COMMAND,
+ name = {"--rdbms:url", "--url"},
+ description = "URL to use for connection to RDBMS.",
+ title = "RDBMS URL")
+ @MutuallyExclusiveWith(tag="mode")
+ @Pattern(pattern="^(http://.*):(d*)(.*)u=(.*)&p=(.*)")
+ protected String rdbmsUrl = "";
+
+ @Option(type = OptionType.COMMAND,
+ name = {"--rdbms:host", "--host"},
+ description = "Host to use for connection to RDBMS.",
+ title = "RDBMS host")
+ @MutuallyExclusiveWith(tag="mode")
+ protected String rdbmsHost = "";
+
+ @RequiredOnlyIf(names={"--rdbms:host", "--host"})
+ @Option(type = OptionType.COMMAND,
+ name = {"--rdbms:user", "-u", "--user"},
+ description = "User for login to RDBMS.",
+ title = "RDBMS user")
+ protected String rdbmsUser;
+
+ @RequiredOnlyIf(names={"--rdbms:host", "--host"})
+ @Option(type = OptionType.COMMAND,
+ name = {"--rdbms:password", "--password"},
+ description = "Password for login to RDBMS.",
+ title = "RDBMS password")
+ protected String rdbmsPassword;
+
+ @Option(type = OptionType.COMMAND,
+ name = {"--driver", "--jars"},
+ description = "List of drivers",
+ title = "--driver --driver ")
+ protected List jars = new ArrayList<>();
+
+ @Override
+ public void run() {
+ //skipping store our choices...
+ if (!help.showHelpIfRequested()) {
+ if(!"".equals(rdbmsHost)) {
+ System.out.println("Connecting to database host: " + rdbmsHost);
+ System.out.println("Credential: " + rdbmsUser + " / " + rdbmsPassword);
+ } else {
+ System.out.println("Connecting to database url: " + rdbmsUrl);
+ }
+ System.out.println(jars.toString());
+ }
+ }
+}
diff --git a/libraries-3/src/main/java/com/baeldung/airline/LoggingCommand.java b/libraries-3/src/main/java/com/baeldung/airline/LoggingCommand.java
new file mode 100644
index 0000000000..4a269f87fd
--- /dev/null
+++ b/libraries-3/src/main/java/com/baeldung/airline/LoggingCommand.java
@@ -0,0 +1,24 @@
+package com.baeldung.airline;
+
+import javax.inject.Inject;
+
+import com.github.rvesse.airline.HelpOption;
+import com.github.rvesse.airline.annotations.Command;
+import com.github.rvesse.airline.annotations.Option;
+
+@Command(name = "setup-log", description = "Setup our log")
+public class LoggingCommand implements Runnable {
+
+ @Inject
+ private HelpOption help;
+
+ @Option(name = { "-v", "--verbose" }, description = "Set log verbosity on/off")
+ private boolean verbose = false;
+
+ @Override
+ public void run() {
+ //skipping store user choice
+ if (!help.showHelpIfRequested())
+ System.out.println("Verbosity: " + verbose);
+ }
+}