-
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.
Merge pull request #18 from SchweizerischeBundesbahnen/feature/10-com…
…mand-line-interface Feature/10 command line interface
- Loading branch information
Showing
10 changed files
with
437 additions
and
110 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
79 changes: 0 additions & 79 deletions
79
src/main/java/ch/sbb/pfi/netzgrafikeditor/Application.java
This file was deleted.
Oops, something went wrong.
38 changes: 38 additions & 0 deletions
38
src/main/java/ch/sbb/pfi/netzgrafikeditor/converter/app/CommandLineConverter.java
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,38 @@ | ||
package ch.sbb.pfi.netzgrafikeditor.converter.app; | ||
|
||
import org.springframework.boot.CommandLineRunner; | ||
import org.springframework.boot.ExitCodeGenerator; | ||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
import picocli.CommandLine; | ||
|
||
@SpringBootApplication | ||
public class CommandLineConverter implements CommandLineRunner, ExitCodeGenerator { | ||
|
||
private static final String FOOTER_KEY = "footer"; | ||
|
||
private final CommandLine.IFactory factory; | ||
private final ConvertCommand convertCommand; | ||
private int exitCode; | ||
|
||
CommandLineConverter(CommandLine.IFactory factory, ConvertCommand convertCommand) { | ||
this.factory = factory; | ||
this.convertCommand = convertCommand; | ||
} | ||
|
||
public static void main(String[] args) { | ||
System.exit(SpringApplication.exit(SpringApplication.run(CommandLineConverter.class, args))); | ||
} | ||
|
||
@Override | ||
public void run(String... args) { | ||
CommandLine commandLine = new CommandLine(convertCommand, factory); | ||
commandLine.getHelpSectionMap().put(FOOTER_KEY, convertCommand.new FooterProvider()); | ||
exitCode = commandLine.execute(args); | ||
} | ||
|
||
@Override | ||
public int getExitCode() { | ||
return exitCode; | ||
} | ||
} |
Oops, something went wrong.