-
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.
v0.7.0: command line interface with REPL and argument conversion
Added ----- - Command line interface `RomanRepl` for interactive conversions along with project information and roman syntax help. - Conversion of `java -jar Numerus-*.jar` argument Changed ------- - Ready for internationalization: hardcoded strings are moved to a `ResourceBundle` file * develop: Bump version to v0.7.0 Add v0.7.0 to changelog Add missing Main class in POM and in Manifest Add interpretation of command line arguments Move all Strings to ResourceBundle Add RomanMain as project main class Add RomanRepl for interactive conversions
- Loading branch information
Showing
8 changed files
with
365 additions
and
10 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
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,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<actions> | ||
<action> | ||
<actionName>run</actionName> | ||
<packagings> | ||
<packaging>jar</packaging> | ||
</packagings> | ||
<goals> | ||
<goal>process-classes</goal> | ||
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal> | ||
</goals> | ||
<properties> | ||
<exec.args>-classpath %classpath it.matjaz.numerus.RomanMain</exec.args> | ||
<exec.executable>java</exec.executable> | ||
</properties> | ||
</action> | ||
</actions> |
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
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,67 @@ | ||
/* | ||
* Copyright (c) 2015, Matjaž <dev@matjaz.it> matjaz.it | ||
* | ||
* This Source Code Form is part of the project Numerus, a roman numerals | ||
* library for Java. The library and its source code may be found on: | ||
* https://github.com/MatjazDev/Numerus and http://matjaz.it/numerus/ | ||
* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/ | ||
*/ | ||
package it.matjaz.numerus; | ||
|
||
import java.util.Locale; | ||
import java.util.ResourceBundle; | ||
|
||
/** | ||
* Numerus main class. | ||
* | ||
* Performs no other action than creating and starting a RomanRepl. | ||
* | ||
* Full path: {@code src/main/java/it/matjaz/numerus/RomanMain.java} or | ||
* {@code it.matjaz.numerus.RomanMain} | ||
* | ||
* @author Matjaž <a href="mailto:dev@matjaz.it">dev@matjaz.it</a> | ||
* <a href="http://matjaz.it">matjaz.it</a> | ||
*/ | ||
public class RomanMain { | ||
|
||
/** | ||
* Default ResourceBundle containing english strings. | ||
*/ | ||
private static final ResourceBundle romanBundle = ResourceBundle.getBundle("RomanBundle", Locale.US); | ||
|
||
/** | ||
* Starts the Numerus project. | ||
* | ||
* Starts a REPL to interact with the conversion tools. Alternatively, if | ||
* any command line arguments are passed, tries to interprete theme without | ||
* starting an interactive Numerus shell. | ||
* | ||
* @param args the numbers to convert or REPL commands to execute | ||
*/ | ||
public static void main(String[] args) { | ||
if (args.length > 0) { | ||
interpreteCommandLineArguments(args); | ||
} else { | ||
RomanRepl repl = new RomanRepl(); | ||
repl.start(); | ||
} | ||
} | ||
|
||
/** | ||
* Creates a REPL from which calls the input interpreter for each passed | ||
* argument without creating an interactive shell waiting for input. | ||
* | ||
* @param args the numbers to convert or REPL commands to execute | ||
*/ | ||
private static void interpreteCommandLineArguments(String[] args) { | ||
RomanRepl repl = new RomanRepl(); | ||
for (String command : args) { | ||
System.out.println(romanBundle.getString("Prompt") + command); | ||
repl.interpreteSingleCommand(command); | ||
} | ||
} | ||
|
||
} |
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
Oops, something went wrong.