-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Current usage of CLI: | ||
First, run "fatJar" gradle task in java-pfb-cli | ||
|
||
Then, you can use the CLI with the following command: | ||
java -cp "java-pfb-cli/build/libs/java-pfb-cli.jar" JavaPfbCommand <command> <args> | ||
Only command right now: "hello" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
plugins { | ||
id 'java' | ||
} | ||
|
||
version 'unspecified' | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1' | ||
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1' | ||
implementation 'info.picocli:picocli:4.7.4' | ||
} | ||
|
||
task fatJar(type: Jar) { | ||
manifest { | ||
attributes 'Main-Class': "JavaPfbCommand" | ||
} | ||
archiveBaseName.set('java-pfb-cli') | ||
from { | ||
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } | ||
} | ||
with jar | ||
} | ||
|
||
test { | ||
useJUnitPlatform() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import picocli.CommandLine; | ||
|
||
import static picocli.CommandLine.Command; | ||
|
||
@Command(name = "pfb") | ||
public class JavaPfbCommand implements Runnable { | ||
public static void main(String[] args) { | ||
CommandLine.run(new JavaPfbCommand(), args); | ||
} | ||
|
||
@Override | ||
public void run() { | ||
System.out.println("A java implementation of pyPFB"); | ||
} | ||
|
||
@Command(name = "hello") | ||
public void helloCommand() { | ||
System.out.println("Hello world!"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters