Skip to content

Commit 6ae20ca

Browse files
committed
fix: install script, option reader
1 parent 206e7b1 commit 6ae20ca

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

cli/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ jar {
1313
}
1414

1515
tasks.register('fatJar', Jar) {
16+
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
1617
manifest.from jar.manifest
1718
from compileJava.outputs.files
1819
from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } }

cli/scripts/install.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
SCRIPT=$(realpath "$0")
2+
SCRIPTPATH=$(dirname "$SCRIPT")
3+
14
mkdir -p /usr/share/kayjam
2-
cp ../build/libs/*.jar /usr/share/kayjam/kayjam-cli.jar
3-
cp ./kayjam /usr/share/kayjam/kayjam
5+
cp $SCRIPTPATH/../build/libs/*.jar /usr/share/kayjam/kayjam-cli.jar
6+
cp $SCRIPTPATH/kayjam /usr/share/kayjam/kayjam
47
chmod +x /usr/share/kayjam/kayjam
58
ln -s /usr/share/kayjam/kayjam /usr/bin

cli/src/main/java/com/github/kayjamlang/cli/MainCli.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ public class MainCli {
2020

2121
public static void main(String[] args) {
2222
Option typeOption = new Option("t", "type", true, "Backend type: " + compilers.keySet());
23-
typeOption.setArgs(1);
23+
typeOption.setRequired(true);
2424

2525
Option outputOption = new Option("o", "output", true, "Output folder");
26-
outputOption.setArgs(1);
26+
outputOption.setRequired(true);
2727

2828
Option inputOption = new Option("i", "input", true, "Input folder");
29-
inputOption.setArgs(1);
29+
inputOption.setRequired(true);
3030

3131
Options options = new Options();
3232
options.addOption(typeOption);
@@ -36,7 +36,9 @@ public static void main(String[] args) {
3636
CommandLineParser cmdLinePosixParser = new DefaultParser();
3737
try {
3838
CommandLine commandLine = cmdLinePosixParser.parse(options, args);
39-
String type = commandLine.getOptionValue(typeOption);
39+
String type = commandLine.getOptionValue(typeOption).replace(" ", "");
40+
System.out.println(compilers.get(type));
41+
System.out.println("\'"+type+"\'");
4042
if (compilers.containsKey(type)) {
4143
IBackendCompiler backendCompiler = compilers.get(type);
4244
backendCompiler.addOptions(options);

0 commit comments

Comments
 (0)