Skip to content

Commit e0504fa

Browse files
committed
added picocli
1 parent fd48303 commit e0504fa

File tree

4 files changed

+36
-3
lines changed

4 files changed

+36
-3
lines changed

app/Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
build-dist:
2+
./gradlew run
3+
4+
run-dist: build-dist
5+
/bin/sh ./build/install/app/bin/app
6+
7+
run:
8+
./build/install/app/bin/app

app/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ dependencies {
2323
testImplementation(platform("org.junit:junit-bom:5.10.3"))
2424
testImplementation("org.junit.jupiter:junit-jupiter")
2525
implementation("org.apache.commons:commons-lang3:3.13.0")
26+
implementation("info.picocli:picocli:4.7.6")
2627
}
2728

2829
tasks.test {
Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,27 @@
11
package hexlet.code;
22

3-
public class App {
3+
import picocli.CommandLine;
4+
import picocli.CommandLine.Command;
5+
import picocli.CommandLine.Option;
6+
7+
8+
@Command(name = "gendiff", mixinStandardHelpOptions = true, version = "gendiff 1.1.1",
9+
description = "Compares two configuration files and shows a difference.")
10+
11+
class App implements Runnable {
12+
13+
@Option(names = { "-h", "--help" }, usageHelp = true, description = "Show this help message and exit.")
14+
boolean usageHelpRequested;
15+
16+
@Option(names = { "-V", "--version" }, versionHelp = true, description = "Print version information and exit.")
17+
boolean versionInfoRequested;
18+
19+
@Override
20+
public void run () {
21+
System.out.println("Use -h or --help to see available options.");
22+
}
23+
424
public static void main(String[] args) {
5-
System.out.println("Hello World!");
25+
new CommandLine(new App()).execute(args);
626
}
7-
}
27+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package hexlet.code;
2+
3+
public class Differ {
4+
}

0 commit comments

Comments
 (0)