diff --git a/.gitignore b/.gitignore index d13cdd31d..8583250c6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,6 @@ -*.iml -*.ipr -*.iws -/target -/.classpath -/.project -/.settings/ +*.i?? +target +.classpath +.project +.settings/ .idea diff --git a/builtins/pom.xml b/builtins/pom.xml new file mode 100644 index 000000000..cf81eaf20 --- /dev/null +++ b/builtins/pom.xml @@ -0,0 +1,44 @@ + + + + + 4.0.0 + + + org.jline + jline-parent + 3.2.0-SNAPSHOT + + + jline-builtins + JLine Builtins + + + + org.jline + jline-reader + + + + com.googlecode.juniversalchardet + juniversalchardet + true + + + + junit + junit + test + + + + diff --git a/src/main/java/org/jline/builtins/Commands.java b/builtins/src/main/java/org/jline/builtins/Commands.java similarity index 100% rename from src/main/java/org/jline/builtins/Commands.java rename to builtins/src/main/java/org/jline/builtins/Commands.java diff --git a/src/main/java/org/jline/builtins/Completers.java b/builtins/src/main/java/org/jline/builtins/Completers.java similarity index 100% rename from src/main/java/org/jline/builtins/Completers.java rename to builtins/src/main/java/org/jline/builtins/Completers.java diff --git a/src/main/java/org/jline/builtins/Less.java b/builtins/src/main/java/org/jline/builtins/Less.java similarity index 100% rename from src/main/java/org/jline/builtins/Less.java rename to builtins/src/main/java/org/jline/builtins/Less.java diff --git a/src/main/java/org/jline/builtins/Nano.java b/builtins/src/main/java/org/jline/builtins/Nano.java similarity index 100% rename from src/main/java/org/jline/builtins/Nano.java rename to builtins/src/main/java/org/jline/builtins/Nano.java diff --git a/src/main/java/org/jline/builtins/Options.java b/builtins/src/main/java/org/jline/builtins/Options.java similarity index 100% rename from src/main/java/org/jline/builtins/Options.java rename to builtins/src/main/java/org/jline/builtins/Options.java diff --git a/src/main/java/org/jline/builtins/ScreenTerminal.java b/builtins/src/main/java/org/jline/builtins/ScreenTerminal.java similarity index 100% rename from src/main/java/org/jline/builtins/ScreenTerminal.java rename to builtins/src/main/java/org/jline/builtins/ScreenTerminal.java diff --git a/src/main/java/org/jline/builtins/Source.java b/builtins/src/main/java/org/jline/builtins/Source.java similarity index 100% rename from src/main/java/org/jline/builtins/Source.java rename to builtins/src/main/java/org/jline/builtins/Source.java diff --git a/src/main/java/org/jline/builtins/Tmux.java b/builtins/src/main/java/org/jline/builtins/Tmux.java similarity index 100% rename from src/main/java/org/jline/builtins/Tmux.java rename to builtins/src/main/java/org/jline/builtins/Tmux.java diff --git a/src/main/resources/org/jline/builtins/nano-browser-help.txt b/builtins/src/main/resources/org/jline/builtins/nano-browser-help.txt similarity index 100% rename from src/main/resources/org/jline/builtins/nano-browser-help.txt rename to builtins/src/main/resources/org/jline/builtins/nano-browser-help.txt diff --git a/src/main/resources/org/jline/builtins/nano-main-help.txt b/builtins/src/main/resources/org/jline/builtins/nano-main-help.txt similarity index 100% rename from src/main/resources/org/jline/builtins/nano-main-help.txt rename to builtins/src/main/resources/org/jline/builtins/nano-main-help.txt diff --git a/src/main/resources/org/jline/builtins/nano-read-help.txt b/builtins/src/main/resources/org/jline/builtins/nano-read-help.txt similarity index 100% rename from src/main/resources/org/jline/builtins/nano-read-help.txt rename to builtins/src/main/resources/org/jline/builtins/nano-read-help.txt diff --git a/src/main/resources/org/jline/builtins/nano-search-help.txt b/builtins/src/main/resources/org/jline/builtins/nano-search-help.txt similarity index 100% rename from src/main/resources/org/jline/builtins/nano-search-help.txt rename to builtins/src/main/resources/org/jline/builtins/nano-search-help.txt diff --git a/src/main/resources/org/jline/builtins/nano-write-help.txt b/builtins/src/main/resources/org/jline/builtins/nano-write-help.txt similarity index 100% rename from src/main/resources/org/jline/builtins/nano-write-help.txt rename to builtins/src/main/resources/org/jline/builtins/nano-write-help.txt diff --git a/src/test/java/org/jline/builtins/OptionsTest.java b/builtins/src/test/java/org/jline/builtins/OptionsTest.java similarity index 100% rename from src/test/java/org/jline/builtins/OptionsTest.java rename to builtins/src/test/java/org/jline/builtins/OptionsTest.java diff --git a/src/test/java/org/jline/example/Example.java b/builtins/src/test/java/org/jline/example/Example.java similarity index 100% rename from src/test/java/org/jline/example/Example.java rename to builtins/src/test/java/org/jline/example/Example.java diff --git a/src/test/java/org/jline/example/PasswordReader.java b/builtins/src/test/java/org/jline/example/PasswordReader.java similarity index 100% rename from src/test/java/org/jline/example/PasswordReader.java rename to builtins/src/test/java/org/jline/example/PasswordReader.java diff --git a/jline/pom.xml b/jline/pom.xml new file mode 100644 index 000000000..5441e8800 --- /dev/null +++ b/jline/pom.xml @@ -0,0 +1,179 @@ + + + + + 4.0.0 + + + org.jline + jline-parent + 3.2.0-SNAPSHOT + + + jline + JLine Bundle + + + + org.fusesource.jansi + jansi + true + + + net.java.dev.jna + jna + true + + + com.googlecode.juniversalchardet + juniversalchardet + true + + + + + + + maven-dependency-plugin + + + process-sources + + unpack + + + + + + org.jline + jline-terminal + sources + jar + false + ${project.build.directory}/generated-sources + + + org.jline + jline-terminal-jansi + sources + jar + false + ${project.build.directory}/generated-sources + + + org.jline + jline-terminal-jna + sources + jar + false + ${project.build.directory}/generated-sources + + + org.jline + jline-reader + sources + jar + false + ${project.build.directory}/generated-sources + + + org.jline + jline-builtins + sources + jar + false + ${project.build.directory}/generated-sources + + + + + org.jline + jline-terminal + jar + false + ${project.build.directory}/generated-resources + **/*.class + + + org.jline + jline-terminal-jansi + jar + false + ${project.build.directory}/generated-resources + **/*.class + + + org.jline + jline-terminal-jna + jar + false + ${project.build.directory}/generated-resources + **/*.class + + + org.jline + jline-reader + jar + false + ${project.build.directory}/generated-resources + **/*.class + + + org.jline + jline-builtins + jar + false + ${project.build.directory}/generated-resources + **/*.class + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 1.12 + + + add-source + generate-sources + + add-source + + + + ${project.build.directory}/generated-sources + + + + + add-resource + generate-resources + + add-resource + + + + + ${project.build.directory}/generated-resources + + + + + + + + + + diff --git a/pom.xml b/pom.xml index 6aafc6b28..de72142c1 100644 --- a/pom.xml +++ b/pom.xml @@ -20,9 +20,11 @@ org.jline - jline - JLine + jline-parent + JLine Parent + JLine 3.2.0-SNAPSHOT + pom @@ -66,19 +68,15 @@ UTF-8 - UTF-8 - yyyyMMddHHmm - ${maven.build.timestamp} - - - true 1.8 1.8 4.2.2 1.14 1.0.3 + 3.3.1 + 4.12 @@ -87,167 +85,74 @@ 2.2.1 - - - org.fusesource.jansi - jansi - ${jansi.version} - true - - - - com.googlecode.juniversalchardet - juniversalchardet - ${juniversalchardet.version} - true - - - - net.java.dev.jna - jna - ${jna.version} - true - - - - org.easymock - easymock - 3.3.1 - test - - - - org.powermock - powermock-module-junit4 - 1.6.2 - test - - - - org.powermock - powermock-api-easymock - 1.6.2 - test - - - - org.ow2.asm - asm - 5.0.3 - test - - - - junit - junit - 4.12 - test - - + + + + org.jline + jline-terminal + ${project.version} + + + + org.jline + jline-terminal-jansi + ${project.version} + + + + org.jline + jline-terminal-jna + ${project.version} + + + + org.jline + jline-reader + ${project.version} + + + + org.jline + jline-builtins + ${project.version} + + + + org.fusesource.jansi + jansi + ${jansi.version} + + + + net.java.dev.jna + jna + ${jna.version} + + + + com.googlecode.juniversalchardet + juniversalchardet + ${juniversalchardet.version} + + + + org.easymock + easymock + ${easymock.version} + + + + junit + junit + ${junit.version} + + + install - - - ${project.basedir}/src/main/resources - false - - **/* - - - - - ${project.basedir}/src/main/filtered-resources - true - - **/* - - - - - - - ${project.basedir}/src/test/resources - false - - **/* - - - - - ${project.basedir}/src/test/filtered-resources - true - - **/* - - - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 2.10.4 - - - -Xdoclint:none - - false - - - - - - org.eclipse.m2e - lifecycle-mapping - 1.0.0 - - - - - - org.apache.maven.plugins - maven-enforcer-plugin - [1.0,) - - enforce - - - - - - - - - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.19.1 - - ${maven.test.redirectTestOutputToFile} - - once - ${surefire.argLine} - false - ${project.build.directory} - - **/Abstract*.java - **/Test*.java - - - **/*Test.java - - - - org.apache.maven.plugins maven-compiler-plugin @@ -264,35 +169,21 @@ - - org.apache.maven.plugins - maven-source-plugin - 3.0.1 - - - attach-sources - - jar-no-fork - - - - - org.apache.felix maven-bundle-plugin 3.2.0 + + + *;-noimport:=true + + process-classes manifest - - - * - - @@ -310,67 +201,47 @@ org.apache.maven.plugins - maven-javadoc-plugin - 2.10.4 + maven-surefire-plugin + 2.19.1 + + true + ${surefire.argLine} + false + + + + + org.apache.maven.plugins + maven-source-plugin + 3.0.1 - javadoc + attach-sources - jar + jar-no-fork - - com.mycila.maven-license-plugin - maven-license-plugin - 1.9.0 + org.apache.maven.plugins + maven-javadoc-plugin + 2.10.4 - true - true -
${project.basedir}/header.txt
- false - - **/pom.xml - **/*.xml - **/*.xsd - **/*.xjb - **/*.properties - **/*.ini - **/*.java - **/*.groovy - **/*.scala - **/*.aj - **/*.js - **/*.css - **/*.help - **/*.proto - **/*.sm - **/*.bat - **/*.vm - **/*.md - - - **/target/** - **/.*/** - - - SLASHSTAR_STYLE - SLASHSTAR_STYLE - XML_STYLE - DOUBLESLASH_STYLE - DOUBLESLASH_STYLE - SCRIPT_STYLE - SCRIPT_STYLE - XML_STYLE - + -Xdoclint:none + false
+ + + javadoc + + jar + + +
+
@@ -398,5 +269,13 @@ + + terminal + terminal-jna + terminal-jansi + reader + builtins + jline + diff --git a/reader/pom.xml b/reader/pom.xml new file mode 100644 index 000000000..eb493fd3e --- /dev/null +++ b/reader/pom.xml @@ -0,0 +1,38 @@ + + + + + 4.0.0 + + + org.jline + jline-parent + 3.2.0-SNAPSHOT + + + jline-reader + JLine Reader + + + + org.jline + jline-terminal + + + + junit + junit + test + + + + diff --git a/src/main/java/org/jline/keymap/BindingReader.java b/reader/src/main/java/org/jline/keymap/BindingReader.java similarity index 100% rename from src/main/java/org/jline/keymap/BindingReader.java rename to reader/src/main/java/org/jline/keymap/BindingReader.java diff --git a/src/main/java/org/jline/keymap/KeyMap.java b/reader/src/main/java/org/jline/keymap/KeyMap.java similarity index 100% rename from src/main/java/org/jline/keymap/KeyMap.java rename to reader/src/main/java/org/jline/keymap/KeyMap.java diff --git a/src/main/java/org/jline/reader/Binding.java b/reader/src/main/java/org/jline/reader/Binding.java similarity index 100% rename from src/main/java/org/jline/reader/Binding.java rename to reader/src/main/java/org/jline/reader/Binding.java diff --git a/src/main/java/org/jline/reader/Buffer.java b/reader/src/main/java/org/jline/reader/Buffer.java similarity index 100% rename from src/main/java/org/jline/reader/Buffer.java rename to reader/src/main/java/org/jline/reader/Buffer.java diff --git a/src/main/java/org/jline/reader/Candidate.java b/reader/src/main/java/org/jline/reader/Candidate.java similarity index 100% rename from src/main/java/org/jline/reader/Candidate.java rename to reader/src/main/java/org/jline/reader/Candidate.java diff --git a/src/main/java/org/jline/reader/Completer.java b/reader/src/main/java/org/jline/reader/Completer.java similarity index 100% rename from src/main/java/org/jline/reader/Completer.java rename to reader/src/main/java/org/jline/reader/Completer.java diff --git a/src/main/java/org/jline/reader/EOFError.java b/reader/src/main/java/org/jline/reader/EOFError.java similarity index 100% rename from src/main/java/org/jline/reader/EOFError.java rename to reader/src/main/java/org/jline/reader/EOFError.java diff --git a/src/main/java/org/jline/reader/EndOfFileException.java b/reader/src/main/java/org/jline/reader/EndOfFileException.java similarity index 100% rename from src/main/java/org/jline/reader/EndOfFileException.java rename to reader/src/main/java/org/jline/reader/EndOfFileException.java diff --git a/src/main/java/org/jline/reader/Expander.java b/reader/src/main/java/org/jline/reader/Expander.java similarity index 100% rename from src/main/java/org/jline/reader/Expander.java rename to reader/src/main/java/org/jline/reader/Expander.java diff --git a/src/main/java/org/jline/reader/Highlighter.java b/reader/src/main/java/org/jline/reader/Highlighter.java similarity index 100% rename from src/main/java/org/jline/reader/Highlighter.java rename to reader/src/main/java/org/jline/reader/Highlighter.java diff --git a/src/main/java/org/jline/reader/History.java b/reader/src/main/java/org/jline/reader/History.java similarity index 100% rename from src/main/java/org/jline/reader/History.java rename to reader/src/main/java/org/jline/reader/History.java diff --git a/src/main/java/org/jline/reader/LineReader.java b/reader/src/main/java/org/jline/reader/LineReader.java similarity index 100% rename from src/main/java/org/jline/reader/LineReader.java rename to reader/src/main/java/org/jline/reader/LineReader.java diff --git a/src/main/java/org/jline/reader/LineReaderBuilder.java b/reader/src/main/java/org/jline/reader/LineReaderBuilder.java similarity index 100% rename from src/main/java/org/jline/reader/LineReaderBuilder.java rename to reader/src/main/java/org/jline/reader/LineReaderBuilder.java diff --git a/src/main/java/org/jline/reader/Macro.java b/reader/src/main/java/org/jline/reader/Macro.java similarity index 100% rename from src/main/java/org/jline/reader/Macro.java rename to reader/src/main/java/org/jline/reader/Macro.java diff --git a/src/main/java/org/jline/reader/ParsedLine.java b/reader/src/main/java/org/jline/reader/ParsedLine.java similarity index 100% rename from src/main/java/org/jline/reader/ParsedLine.java rename to reader/src/main/java/org/jline/reader/ParsedLine.java diff --git a/src/main/java/org/jline/reader/Parser.java b/reader/src/main/java/org/jline/reader/Parser.java similarity index 100% rename from src/main/java/org/jline/reader/Parser.java rename to reader/src/main/java/org/jline/reader/Parser.java diff --git a/src/main/java/org/jline/reader/Reference.java b/reader/src/main/java/org/jline/reader/Reference.java similarity index 100% rename from src/main/java/org/jline/reader/Reference.java rename to reader/src/main/java/org/jline/reader/Reference.java diff --git a/src/main/java/org/jline/reader/SyntaxError.java b/reader/src/main/java/org/jline/reader/SyntaxError.java similarity index 100% rename from src/main/java/org/jline/reader/SyntaxError.java rename to reader/src/main/java/org/jline/reader/SyntaxError.java diff --git a/src/main/java/org/jline/reader/UserInterruptException.java b/reader/src/main/java/org/jline/reader/UserInterruptException.java similarity index 100% rename from src/main/java/org/jline/reader/UserInterruptException.java rename to reader/src/main/java/org/jline/reader/UserInterruptException.java diff --git a/src/main/java/org/jline/reader/Widget.java b/reader/src/main/java/org/jline/reader/Widget.java similarity index 100% rename from src/main/java/org/jline/reader/Widget.java rename to reader/src/main/java/org/jline/reader/Widget.java diff --git a/src/main/java/org/jline/reader/impl/BufferImpl.java b/reader/src/main/java/org/jline/reader/impl/BufferImpl.java similarity index 100% rename from src/main/java/org/jline/reader/impl/BufferImpl.java rename to reader/src/main/java/org/jline/reader/impl/BufferImpl.java diff --git a/src/main/java/org/jline/reader/impl/DefaultExpander.java b/reader/src/main/java/org/jline/reader/impl/DefaultExpander.java similarity index 100% rename from src/main/java/org/jline/reader/impl/DefaultExpander.java rename to reader/src/main/java/org/jline/reader/impl/DefaultExpander.java diff --git a/src/main/java/org/jline/reader/impl/DefaultHighlighter.java b/reader/src/main/java/org/jline/reader/impl/DefaultHighlighter.java similarity index 100% rename from src/main/java/org/jline/reader/impl/DefaultHighlighter.java rename to reader/src/main/java/org/jline/reader/impl/DefaultHighlighter.java diff --git a/src/main/java/org/jline/reader/impl/DefaultParser.java b/reader/src/main/java/org/jline/reader/impl/DefaultParser.java similarity index 100% rename from src/main/java/org/jline/reader/impl/DefaultParser.java rename to reader/src/main/java/org/jline/reader/impl/DefaultParser.java diff --git a/src/main/java/org/jline/reader/impl/KillRing.java b/reader/src/main/java/org/jline/reader/impl/KillRing.java similarity index 100% rename from src/main/java/org/jline/reader/impl/KillRing.java rename to reader/src/main/java/org/jline/reader/impl/KillRing.java diff --git a/src/main/java/org/jline/reader/impl/LineReaderImpl.java b/reader/src/main/java/org/jline/reader/impl/LineReaderImpl.java similarity index 100% rename from src/main/java/org/jline/reader/impl/LineReaderImpl.java rename to reader/src/main/java/org/jline/reader/impl/LineReaderImpl.java diff --git a/src/main/java/org/jline/reader/impl/ReaderUtils.java b/reader/src/main/java/org/jline/reader/impl/ReaderUtils.java similarity index 100% rename from src/main/java/org/jline/reader/impl/ReaderUtils.java rename to reader/src/main/java/org/jline/reader/impl/ReaderUtils.java diff --git a/src/main/java/org/jline/reader/impl/UndoTree.java b/reader/src/main/java/org/jline/reader/impl/UndoTree.java similarity index 100% rename from src/main/java/org/jline/reader/impl/UndoTree.java rename to reader/src/main/java/org/jline/reader/impl/UndoTree.java diff --git a/src/main/java/org/jline/reader/impl/completer/AggregateCompleter.java b/reader/src/main/java/org/jline/reader/impl/completer/AggregateCompleter.java similarity index 100% rename from src/main/java/org/jline/reader/impl/completer/AggregateCompleter.java rename to reader/src/main/java/org/jline/reader/impl/completer/AggregateCompleter.java diff --git a/src/main/java/org/jline/reader/impl/completer/ArgumentCompleter.java b/reader/src/main/java/org/jline/reader/impl/completer/ArgumentCompleter.java similarity index 100% rename from src/main/java/org/jline/reader/impl/completer/ArgumentCompleter.java rename to reader/src/main/java/org/jline/reader/impl/completer/ArgumentCompleter.java diff --git a/src/main/java/org/jline/reader/impl/completer/EnumCompleter.java b/reader/src/main/java/org/jline/reader/impl/completer/EnumCompleter.java similarity index 100% rename from src/main/java/org/jline/reader/impl/completer/EnumCompleter.java rename to reader/src/main/java/org/jline/reader/impl/completer/EnumCompleter.java diff --git a/src/main/java/org/jline/reader/impl/completer/FileNameCompleter.java b/reader/src/main/java/org/jline/reader/impl/completer/FileNameCompleter.java similarity index 100% rename from src/main/java/org/jline/reader/impl/completer/FileNameCompleter.java rename to reader/src/main/java/org/jline/reader/impl/completer/FileNameCompleter.java diff --git a/src/main/java/org/jline/reader/impl/completer/NullCompleter.java b/reader/src/main/java/org/jline/reader/impl/completer/NullCompleter.java similarity index 100% rename from src/main/java/org/jline/reader/impl/completer/NullCompleter.java rename to reader/src/main/java/org/jline/reader/impl/completer/NullCompleter.java diff --git a/src/main/java/org/jline/reader/impl/completer/StringsCompleter.java b/reader/src/main/java/org/jline/reader/impl/completer/StringsCompleter.java similarity index 100% rename from src/main/java/org/jline/reader/impl/completer/StringsCompleter.java rename to reader/src/main/java/org/jline/reader/impl/completer/StringsCompleter.java diff --git a/src/main/java/org/jline/reader/impl/completer/package-info.java b/reader/src/main/java/org/jline/reader/impl/completer/package-info.java similarity index 100% rename from src/main/java/org/jline/reader/impl/completer/package-info.java rename to reader/src/main/java/org/jline/reader/impl/completer/package-info.java diff --git a/src/main/java/org/jline/reader/impl/history/DefaultHistory.java b/reader/src/main/java/org/jline/reader/impl/history/DefaultHistory.java similarity index 100% rename from src/main/java/org/jline/reader/impl/history/DefaultHistory.java rename to reader/src/main/java/org/jline/reader/impl/history/DefaultHistory.java diff --git a/src/main/java/org/jline/reader/impl/history/package-info.java b/reader/src/main/java/org/jline/reader/impl/history/package-info.java similarity index 100% rename from src/main/java/org/jline/reader/impl/history/package-info.java rename to reader/src/main/java/org/jline/reader/impl/history/package-info.java diff --git a/src/main/java/org/jline/reader/package-info.java b/reader/src/main/java/org/jline/reader/package-info.java similarity index 100% rename from src/main/java/org/jline/reader/package-info.java rename to reader/src/main/java/org/jline/reader/package-info.java diff --git a/src/test/java/org/jline/keymap/BindingReaderTest.java b/reader/src/test/java/org/jline/keymap/BindingReaderTest.java similarity index 100% rename from src/test/java/org/jline/keymap/BindingReaderTest.java rename to reader/src/test/java/org/jline/keymap/BindingReaderTest.java diff --git a/src/test/java/org/jline/keymap/KeyMapTest.java b/reader/src/test/java/org/jline/keymap/KeyMapTest.java similarity index 100% rename from src/test/java/org/jline/keymap/KeyMapTest.java rename to reader/src/test/java/org/jline/keymap/KeyMapTest.java diff --git a/src/test/java/org/jline/reader/completer/ArgumentCompleterTest.java b/reader/src/test/java/org/jline/reader/completer/ArgumentCompleterTest.java similarity index 100% rename from src/test/java/org/jline/reader/completer/ArgumentCompleterTest.java rename to reader/src/test/java/org/jline/reader/completer/ArgumentCompleterTest.java diff --git a/src/test/java/org/jline/reader/completer/DefaultParserTest.java b/reader/src/test/java/org/jline/reader/completer/DefaultParserTest.java similarity index 100% rename from src/test/java/org/jline/reader/completer/DefaultParserTest.java rename to reader/src/test/java/org/jline/reader/completer/DefaultParserTest.java diff --git a/src/test/java/org/jline/reader/completer/NullCompleterTest.java b/reader/src/test/java/org/jline/reader/completer/NullCompleterTest.java similarity index 100% rename from src/test/java/org/jline/reader/completer/NullCompleterTest.java rename to reader/src/test/java/org/jline/reader/completer/NullCompleterTest.java diff --git a/src/test/java/org/jline/reader/completer/StringsCompleterTest.java b/reader/src/test/java/org/jline/reader/completer/StringsCompleterTest.java similarity index 100% rename from src/test/java/org/jline/reader/completer/StringsCompleterTest.java rename to reader/src/test/java/org/jline/reader/completer/StringsCompleterTest.java diff --git a/src/test/java/org/jline/reader/impl/BufferTest.java b/reader/src/test/java/org/jline/reader/impl/BufferTest.java similarity index 100% rename from src/test/java/org/jline/reader/impl/BufferTest.java rename to reader/src/test/java/org/jline/reader/impl/BufferTest.java diff --git a/src/test/java/org/jline/reader/impl/CompletionTest.java b/reader/src/test/java/org/jline/reader/impl/CompletionTest.java similarity index 100% rename from src/test/java/org/jline/reader/impl/CompletionTest.java rename to reader/src/test/java/org/jline/reader/impl/CompletionTest.java diff --git a/src/test/java/org/jline/reader/impl/DigitArgumentTest.java b/reader/src/test/java/org/jline/reader/impl/DigitArgumentTest.java similarity index 100% rename from src/test/java/org/jline/reader/impl/DigitArgumentTest.java rename to reader/src/test/java/org/jline/reader/impl/DigitArgumentTest.java diff --git a/src/test/java/org/jline/reader/impl/EditLineTest.java b/reader/src/test/java/org/jline/reader/impl/EditLineTest.java similarity index 100% rename from src/test/java/org/jline/reader/impl/EditLineTest.java rename to reader/src/test/java/org/jline/reader/impl/EditLineTest.java diff --git a/src/test/java/org/jline/reader/impl/HistorySearchTest.java b/reader/src/test/java/org/jline/reader/impl/HistorySearchTest.java similarity index 100% rename from src/test/java/org/jline/reader/impl/HistorySearchTest.java rename to reader/src/test/java/org/jline/reader/impl/HistorySearchTest.java diff --git a/src/test/java/org/jline/reader/impl/KillRingTest.java b/reader/src/test/java/org/jline/reader/impl/KillRingTest.java similarity index 100% rename from src/test/java/org/jline/reader/impl/KillRingTest.java rename to reader/src/test/java/org/jline/reader/impl/KillRingTest.java diff --git a/src/test/java/org/jline/reader/impl/LineReaderTest.java b/reader/src/test/java/org/jline/reader/impl/LineReaderTest.java similarity index 100% rename from src/test/java/org/jline/reader/impl/LineReaderTest.java rename to reader/src/test/java/org/jline/reader/impl/LineReaderTest.java diff --git a/src/test/java/org/jline/reader/impl/MultiByteCharTest.java b/reader/src/test/java/org/jline/reader/impl/MultiByteCharTest.java similarity index 100% rename from src/test/java/org/jline/reader/impl/MultiByteCharTest.java rename to reader/src/test/java/org/jline/reader/impl/MultiByteCharTest.java diff --git a/src/test/java/org/jline/reader/impl/ReaderTestSupport.java b/reader/src/test/java/org/jline/reader/impl/ReaderTestSupport.java similarity index 100% rename from src/test/java/org/jline/reader/impl/ReaderTestSupport.java rename to reader/src/test/java/org/jline/reader/impl/ReaderTestSupport.java diff --git a/src/test/java/org/jline/reader/impl/TerminalReaderTest.java b/reader/src/test/java/org/jline/reader/impl/TerminalReaderTest.java similarity index 100% rename from src/test/java/org/jline/reader/impl/TerminalReaderTest.java rename to reader/src/test/java/org/jline/reader/impl/TerminalReaderTest.java diff --git a/src/test/java/org/jline/reader/impl/ViMoveModeTest.java b/reader/src/test/java/org/jline/reader/impl/ViMoveModeTest.java similarity index 100% rename from src/test/java/org/jline/reader/impl/ViMoveModeTest.java rename to reader/src/test/java/org/jline/reader/impl/ViMoveModeTest.java diff --git a/src/test/java/org/jline/reader/impl/history/HistoryPersistenceTest.java b/reader/src/test/java/org/jline/reader/impl/history/HistoryPersistenceTest.java similarity index 100% rename from src/test/java/org/jline/reader/impl/history/HistoryPersistenceTest.java rename to reader/src/test/java/org/jline/reader/impl/history/HistoryPersistenceTest.java diff --git a/src/test/java/org/jline/reader/impl/history/HistoryReaderTest.java b/reader/src/test/java/org/jline/reader/impl/history/HistoryReaderTest.java similarity index 100% rename from src/test/java/org/jline/reader/impl/history/HistoryReaderTest.java rename to reader/src/test/java/org/jline/reader/impl/history/HistoryReaderTest.java diff --git a/src/test/java/org/jline/reader/impl/history/HistoryTest.java b/reader/src/test/java/org/jline/reader/impl/history/HistoryTest.java similarity index 100% rename from src/test/java/org/jline/reader/impl/history/HistoryTest.java rename to reader/src/test/java/org/jline/reader/impl/history/HistoryTest.java diff --git a/src/test/java/org/jline/terminal/impl/ExternalTerminalTest.java b/reader/src/test/java/org/jline/terminal/impl/ExternalTerminalTest.java similarity index 100% rename from src/test/java/org/jline/terminal/impl/ExternalTerminalTest.java rename to reader/src/test/java/org/jline/terminal/impl/ExternalTerminalTest.java diff --git a/src/main/java/org/jline/utils/Urls.java b/src/main/java/org/jline/utils/Urls.java deleted file mode 100644 index a67442b1d..000000000 --- a/src/main/java/org/jline/utils/Urls.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2002-2016, the original author or authors. - * - * This software is distributable under the BSD license. See the terms of the - * BSD license in the documentation provided with this software. - * - * http://www.opensource.org/licenses/bsd-license.php - */ -package org.jline.utils; - -import java.io.File; -import java.net.MalformedURLException; -import java.net.URL; - -/** - * URL helpers. - * - * @author Jason Dillon - * @author Guillaume Nodet - * @since 2.7 - */ -public final class Urls -{ - - private Urls() { - } - - public static URL create(final String input) { - if (input == null) { - return null; - } - try { - return new URL(input); - } - catch (MalformedURLException e) { - return create(new File(input)); - } - } - - public static URL create(final File file) { - try { - return file != null ? file.toURI().toURL() : null; - } - catch (MalformedURLException e) { - throw new IllegalStateException(e); - } - } -} \ No newline at end of file diff --git a/terminal-jansi/pom.xml b/terminal-jansi/pom.xml new file mode 100644 index 000000000..a4f367291 --- /dev/null +++ b/terminal-jansi/pom.xml @@ -0,0 +1,43 @@ + + + + + 4.0.0 + + + org.jline + jline-parent + 3.2.0-SNAPSHOT + + + jline-terminal-jansi + JLine JANSI Terminal + + + + org.fusesource.jansi + jansi + + + + org.jline + jline-terminal + + + + junit + junit + test + + + + diff --git a/terminal-jansi/src/main/java/org/jline/terminal/impl/jansi/JansiSupportImpl.java b/terminal-jansi/src/main/java/org/jline/terminal/impl/jansi/JansiSupportImpl.java new file mode 100644 index 000000000..2bb6bcd7c --- /dev/null +++ b/terminal-jansi/src/main/java/org/jline/terminal/impl/jansi/JansiSupportImpl.java @@ -0,0 +1,15 @@ +package org.jline.terminal.impl.jansi; + +import org.jline.terminal.Terminal; +import org.jline.terminal.spi.JansiSupport; + +import java.io.IOException; + +public class JansiSupportImpl implements JansiSupport { + + @Override + public Terminal winSysTerminal(String name, boolean nativeSignals, Terminal.SignalHandler signalHandler) throws IOException { + return new JansiWinSysTerminal(name, nativeSignals, signalHandler); + } + +} diff --git a/src/main/java/org/jline/terminal/impl/jansi/JansiWinSysTerminal.java b/terminal-jansi/src/main/java/org/jline/terminal/impl/jansi/JansiWinSysTerminal.java similarity index 100% rename from src/main/java/org/jline/terminal/impl/jansi/JansiWinSysTerminal.java rename to terminal-jansi/src/main/java/org/jline/terminal/impl/jansi/JansiWinSysTerminal.java diff --git a/terminal-jansi/src/main/resources/META-INF/services/org.jline.terminal.spi.JansiSupport b/terminal-jansi/src/main/resources/META-INF/services/org.jline.terminal.spi.JansiSupport new file mode 100644 index 000000000..d47de2ba1 --- /dev/null +++ b/terminal-jansi/src/main/resources/META-INF/services/org.jline.terminal.spi.JansiSupport @@ -0,0 +1 @@ +org.jline.terminal.impl.jansi.JansiSupportImpl diff --git a/terminal-jna/pom.xml b/terminal-jna/pom.xml new file mode 100644 index 000000000..75ef0e633 --- /dev/null +++ b/terminal-jna/pom.xml @@ -0,0 +1,43 @@ + + + + + 4.0.0 + + + org.jline + jline-parent + 3.2.0-SNAPSHOT + + + jline-terminal-jna + JLine JNA Terminal + + + + net.java.dev.jna + jna + + + + org.jline + jline-terminal + + + + junit + junit + test + + + + diff --git a/src/main/java/org/jline/terminal/impl/jna/JnaNativePty.java b/terminal-jna/src/main/java/org/jline/terminal/impl/jna/JnaNativePty.java similarity index 99% rename from src/main/java/org/jline/terminal/impl/jna/JnaNativePty.java rename to terminal-jna/src/main/java/org/jline/terminal/impl/jna/JnaNativePty.java index 059f0325f..cc5085208 100644 --- a/src/main/java/org/jline/terminal/impl/jna/JnaNativePty.java +++ b/terminal-jna/src/main/java/org/jline/terminal/impl/jna/JnaNativePty.java @@ -19,7 +19,7 @@ import com.sun.jna.Platform; import org.jline.terminal.Attributes; import org.jline.terminal.Size; -import org.jline.terminal.impl.Pty; +import org.jline.terminal.spi.Pty; import org.jline.terminal.impl.jna.freebsd.FreeBsdNativePty; import org.jline.terminal.impl.jna.linux.LinuxNativePty; import org.jline.terminal.impl.jna.osx.OsXNativePty; diff --git a/terminal-jna/src/main/java/org/jline/terminal/impl/jna/JnaSupportImpl.java b/terminal-jna/src/main/java/org/jline/terminal/impl/jna/JnaSupportImpl.java new file mode 100644 index 000000000..187d44dd8 --- /dev/null +++ b/terminal-jna/src/main/java/org/jline/terminal/impl/jna/JnaSupportImpl.java @@ -0,0 +1,27 @@ +package org.jline.terminal.impl.jna; + +import org.jline.terminal.Attributes; +import org.jline.terminal.Size; +import org.jline.terminal.Terminal; +import org.jline.terminal.impl.jna.win.JnaWinSysTerminal; +import org.jline.terminal.spi.JnaSupport; +import org.jline.terminal.spi.Pty; + +import java.io.IOException; + +public class JnaSupportImpl implements JnaSupport { + @Override + public Pty current() throws IOException { + return JnaNativePty.current(); + } + + @Override + public Pty open(Attributes attributes, Size size) throws IOException { + return JnaNativePty.open(attributes, size); + } + + @Override + public Terminal winSysTerminal(String name, boolean nativeSignals, Terminal.SignalHandler signalHandler) throws IOException { + return new JnaWinSysTerminal(name, nativeSignals, signalHandler); + } +} diff --git a/src/main/java/org/jline/terminal/impl/jna/freebsd/CLibrary.java b/terminal-jna/src/main/java/org/jline/terminal/impl/jna/freebsd/CLibrary.java similarity index 100% rename from src/main/java/org/jline/terminal/impl/jna/freebsd/CLibrary.java rename to terminal-jna/src/main/java/org/jline/terminal/impl/jna/freebsd/CLibrary.java diff --git a/src/main/java/org/jline/terminal/impl/jna/freebsd/FreeBsdNativePty.java b/terminal-jna/src/main/java/org/jline/terminal/impl/jna/freebsd/FreeBsdNativePty.java similarity index 100% rename from src/main/java/org/jline/terminal/impl/jna/freebsd/FreeBsdNativePty.java rename to terminal-jna/src/main/java/org/jline/terminal/impl/jna/freebsd/FreeBsdNativePty.java diff --git a/src/main/java/org/jline/terminal/impl/jna/linux/CLibrary.java b/terminal-jna/src/main/java/org/jline/terminal/impl/jna/linux/CLibrary.java similarity index 100% rename from src/main/java/org/jline/terminal/impl/jna/linux/CLibrary.java rename to terminal-jna/src/main/java/org/jline/terminal/impl/jna/linux/CLibrary.java diff --git a/src/main/java/org/jline/terminal/impl/jna/linux/LinuxNativePty.java b/terminal-jna/src/main/java/org/jline/terminal/impl/jna/linux/LinuxNativePty.java similarity index 100% rename from src/main/java/org/jline/terminal/impl/jna/linux/LinuxNativePty.java rename to terminal-jna/src/main/java/org/jline/terminal/impl/jna/linux/LinuxNativePty.java diff --git a/src/main/java/org/jline/terminal/impl/jna/osx/CLibrary.java b/terminal-jna/src/main/java/org/jline/terminal/impl/jna/osx/CLibrary.java similarity index 100% rename from src/main/java/org/jline/terminal/impl/jna/osx/CLibrary.java rename to terminal-jna/src/main/java/org/jline/terminal/impl/jna/osx/CLibrary.java diff --git a/src/main/java/org/jline/terminal/impl/jna/osx/OsXNativePty.java b/terminal-jna/src/main/java/org/jline/terminal/impl/jna/osx/OsXNativePty.java similarity index 100% rename from src/main/java/org/jline/terminal/impl/jna/osx/OsXNativePty.java rename to terminal-jna/src/main/java/org/jline/terminal/impl/jna/osx/OsXNativePty.java diff --git a/src/main/java/org/jline/terminal/impl/jna/solaris/CLibrary.java b/terminal-jna/src/main/java/org/jline/terminal/impl/jna/solaris/CLibrary.java similarity index 100% rename from src/main/java/org/jline/terminal/impl/jna/solaris/CLibrary.java rename to terminal-jna/src/main/java/org/jline/terminal/impl/jna/solaris/CLibrary.java diff --git a/src/main/java/org/jline/terminal/impl/jna/solaris/SolarisNativePty.java b/terminal-jna/src/main/java/org/jline/terminal/impl/jna/solaris/SolarisNativePty.java similarity index 100% rename from src/main/java/org/jline/terminal/impl/jna/solaris/SolarisNativePty.java rename to terminal-jna/src/main/java/org/jline/terminal/impl/jna/solaris/SolarisNativePty.java diff --git a/src/main/java/org/jline/terminal/impl/jna/win/AnsiOutputStream.java b/terminal-jna/src/main/java/org/jline/terminal/impl/jna/win/AnsiOutputStream.java similarity index 100% rename from src/main/java/org/jline/terminal/impl/jna/win/AnsiOutputStream.java rename to terminal-jna/src/main/java/org/jline/terminal/impl/jna/win/AnsiOutputStream.java diff --git a/src/main/java/org/jline/terminal/impl/jna/win/JnaWinSysTerminal.java b/terminal-jna/src/main/java/org/jline/terminal/impl/jna/win/JnaWinSysTerminal.java similarity index 100% rename from src/main/java/org/jline/terminal/impl/jna/win/JnaWinSysTerminal.java rename to terminal-jna/src/main/java/org/jline/terminal/impl/jna/win/JnaWinSysTerminal.java diff --git a/src/main/java/org/jline/terminal/impl/jna/win/Kernel32.java b/terminal-jna/src/main/java/org/jline/terminal/impl/jna/win/Kernel32.java similarity index 100% rename from src/main/java/org/jline/terminal/impl/jna/win/Kernel32.java rename to terminal-jna/src/main/java/org/jline/terminal/impl/jna/win/Kernel32.java diff --git a/src/main/java/org/jline/terminal/impl/jna/win/WindowsAnsiOutputStream.java b/terminal-jna/src/main/java/org/jline/terminal/impl/jna/win/WindowsAnsiOutputStream.java similarity index 100% rename from src/main/java/org/jline/terminal/impl/jna/win/WindowsAnsiOutputStream.java rename to terminal-jna/src/main/java/org/jline/terminal/impl/jna/win/WindowsAnsiOutputStream.java diff --git a/terminal-jna/src/main/resources/META-INF/services/org.jline.terminal.spi.JnaSupport b/terminal-jna/src/main/resources/META-INF/services/org.jline.terminal.spi.JnaSupport new file mode 100644 index 000000000..41bf9d02f --- /dev/null +++ b/terminal-jna/src/main/resources/META-INF/services/org.jline.terminal.spi.JnaSupport @@ -0,0 +1 @@ +org.jline.terminal.impl.jna.JnaSupportImpl diff --git a/src/test/java/org/jline/terminal/impl/jna/JnaNativePtyTest.java b/terminal-jna/src/test/java/org/jline/terminal/impl/jna/JnaNativePtyTest.java similarity index 100% rename from src/test/java/org/jline/terminal/impl/jna/JnaNativePtyTest.java rename to terminal-jna/src/test/java/org/jline/terminal/impl/jna/JnaNativePtyTest.java diff --git a/terminal/pom.xml b/terminal/pom.xml new file mode 100644 index 000000000..51201456a --- /dev/null +++ b/terminal/pom.xml @@ -0,0 +1,39 @@ + + + + + 4.0.0 + + + org.jline + jline-parent + 3.2.0-SNAPSHOT + + + jline-terminal + JLine Terminal + + + + org.easymock + easymock + test + + + + junit + junit + test + + + + diff --git a/src/main/java/org/jline/terminal/Attributes.java b/terminal/src/main/java/org/jline/terminal/Attributes.java similarity index 100% rename from src/main/java/org/jline/terminal/Attributes.java rename to terminal/src/main/java/org/jline/terminal/Attributes.java diff --git a/src/main/java/org/jline/terminal/Cursor.java b/terminal/src/main/java/org/jline/terminal/Cursor.java similarity index 100% rename from src/main/java/org/jline/terminal/Cursor.java rename to terminal/src/main/java/org/jline/terminal/Cursor.java diff --git a/src/main/java/org/jline/terminal/MouseEvent.java b/terminal/src/main/java/org/jline/terminal/MouseEvent.java similarity index 100% rename from src/main/java/org/jline/terminal/MouseEvent.java rename to terminal/src/main/java/org/jline/terminal/MouseEvent.java diff --git a/src/main/java/org/jline/terminal/Size.java b/terminal/src/main/java/org/jline/terminal/Size.java similarity index 100% rename from src/main/java/org/jline/terminal/Size.java rename to terminal/src/main/java/org/jline/terminal/Size.java diff --git a/src/main/java/org/jline/terminal/Terminal.java b/terminal/src/main/java/org/jline/terminal/Terminal.java similarity index 100% rename from src/main/java/org/jline/terminal/Terminal.java rename to terminal/src/main/java/org/jline/terminal/Terminal.java diff --git a/src/main/java/org/jline/terminal/TerminalBuilder.java b/terminal/src/main/java/org/jline/terminal/TerminalBuilder.java similarity index 91% rename from src/main/java/org/jline/terminal/TerminalBuilder.java rename to terminal/src/main/java/org/jline/terminal/TerminalBuilder.java index 232a5bbf8..dff1ecbfb 100644 --- a/src/main/java/org/jline/terminal/TerminalBuilder.java +++ b/terminal/src/main/java/org/jline/terminal/TerminalBuilder.java @@ -15,6 +15,7 @@ import java.io.InputStream; import java.io.OutputStream; import java.nio.charset.Charset; +import java.util.ServiceLoader; import org.jline.terminal.impl.AbstractPosixTerminal; import org.jline.terminal.impl.DumbTerminal; @@ -22,10 +23,9 @@ import org.jline.terminal.impl.ExternalTerminal; import org.jline.terminal.impl.PosixPtyTerminal; import org.jline.terminal.impl.PosixSysTerminal; -import org.jline.terminal.impl.Pty; -import org.jline.terminal.impl.jansi.JansiWinSysTerminal; -import org.jline.terminal.impl.jna.JnaNativePty; -import org.jline.terminal.impl.jna.win.JnaWinSysTerminal; +import org.jline.terminal.spi.JansiSupport; +import org.jline.terminal.spi.JnaSupport; +import org.jline.terminal.spi.Pty; import org.jline.utils.Log; import org.jline.utils.OSUtils; @@ -198,14 +198,14 @@ private Terminal doBuild() throws IOException { else if (OSUtils.IS_WINDOWS) { if (useJna()) { try { - return new JnaWinSysTerminal(name, nativeSignals, signalHandler); + return load(JnaSupport.class).winSysTerminal(name, nativeSignals, signalHandler); } catch (Throwable t) { Log.debug("Error creating JNA based terminal: ", t.getMessage(), t); exception.addSuppressed(t); } } try { - return new JansiWinSysTerminal(name, nativeSignals, signalHandler); + return load(JansiSupport.class).winSysTerminal(name, nativeSignals, signalHandler); } catch (Throwable t) { Log.debug("Error creating JANSI based terminal: ", t.getMessage(), t); exception.addSuppressed(t); @@ -214,7 +214,7 @@ else if (OSUtils.IS_WINDOWS) { Pty pty = null; if (useJna()) { try { - pty = JnaNativePty.current(); + pty = load(JnaSupport.class).current(); } catch (Throwable t) { // ignore Log.debug("Error creating JNA based pty: ", t.getMessage(), t); @@ -243,16 +243,16 @@ else if (OSUtils.IS_WINDOWS) { } } return new DumbTerminal(name, type != null ? type : Terminal.TYPE_DUMB, - new FileInputStream(FileDescriptor.in), - new FileOutputStream(FileDescriptor.out), - encoding, signalHandler); + new FileInputStream(FileDescriptor.in), + new FileOutputStream(FileDescriptor.out), + encoding, signalHandler); } else { throw exception; } } else { if (useJna()) { try { - Pty pty = JnaNativePty.open(attributes, size); + Pty pty = load(JnaSupport.class).open(attributes, size); return new PosixPtyTerminal(name, type, pty, in, out, encoding, signalHandler); } catch (Throwable t) { Log.debug("Error creating JNA based pty: ", t.getMessage(), t); @@ -272,4 +272,8 @@ else if (OSUtils.IS_WINDOWS) { private boolean useJna() { return jna; } + + private S load(Class clazz) { + return ServiceLoader.load(clazz, clazz.getClassLoader()).iterator().next(); + } } diff --git a/src/main/java/org/jline/terminal/impl/AbstractPosixTerminal.java b/terminal/src/main/java/org/jline/terminal/impl/AbstractPosixTerminal.java similarity index 98% rename from src/main/java/org/jline/terminal/impl/AbstractPosixTerminal.java rename to terminal/src/main/java/org/jline/terminal/impl/AbstractPosixTerminal.java index 01367c157..53005a8a2 100644 --- a/src/main/java/org/jline/terminal/impl/AbstractPosixTerminal.java +++ b/terminal/src/main/java/org/jline/terminal/impl/AbstractPosixTerminal.java @@ -16,6 +16,7 @@ import org.jline.terminal.Attributes; import org.jline.terminal.Cursor; import org.jline.terminal.Size; +import org.jline.terminal.spi.Pty; public abstract class AbstractPosixTerminal extends AbstractTerminal { diff --git a/src/main/java/org/jline/terminal/impl/AbstractTerminal.java b/terminal/src/main/java/org/jline/terminal/impl/AbstractTerminal.java similarity index 100% rename from src/main/java/org/jline/terminal/impl/AbstractTerminal.java rename to terminal/src/main/java/org/jline/terminal/impl/AbstractTerminal.java diff --git a/src/main/java/org/jline/terminal/impl/AbstractWindowsTerminal.java b/terminal/src/main/java/org/jline/terminal/impl/AbstractWindowsTerminal.java similarity index 100% rename from src/main/java/org/jline/terminal/impl/AbstractWindowsTerminal.java rename to terminal/src/main/java/org/jline/terminal/impl/AbstractWindowsTerminal.java diff --git a/src/main/java/org/jline/terminal/impl/CursorSupport.java b/terminal/src/main/java/org/jline/terminal/impl/CursorSupport.java similarity index 100% rename from src/main/java/org/jline/terminal/impl/CursorSupport.java rename to terminal/src/main/java/org/jline/terminal/impl/CursorSupport.java diff --git a/src/main/java/org/jline/terminal/impl/DumbTerminal.java b/terminal/src/main/java/org/jline/terminal/impl/DumbTerminal.java similarity index 100% rename from src/main/java/org/jline/terminal/impl/DumbTerminal.java rename to terminal/src/main/java/org/jline/terminal/impl/DumbTerminal.java diff --git a/src/main/java/org/jline/terminal/impl/ExecPty.java b/terminal/src/main/java/org/jline/terminal/impl/ExecPty.java similarity index 99% rename from src/main/java/org/jline/terminal/impl/ExecPty.java rename to terminal/src/main/java/org/jline/terminal/impl/ExecPty.java index 9b917c54e..61b890dd6 100644 --- a/src/main/java/org/jline/terminal/impl/ExecPty.java +++ b/terminal/src/main/java/org/jline/terminal/impl/ExecPty.java @@ -26,6 +26,7 @@ import org.jline.terminal.Attributes.LocalFlag; import org.jline.terminal.Attributes.OutputFlag; import org.jline.terminal.Size; +import org.jline.terminal.spi.Pty; import org.jline.utils.OSUtils; import static org.jline.utils.ExecHelper.exec; diff --git a/src/main/java/org/jline/terminal/impl/ExternalTerminal.java b/terminal/src/main/java/org/jline/terminal/impl/ExternalTerminal.java similarity index 100% rename from src/main/java/org/jline/terminal/impl/ExternalTerminal.java rename to terminal/src/main/java/org/jline/terminal/impl/ExternalTerminal.java diff --git a/src/main/java/org/jline/terminal/impl/LineDisciplineTerminal.java b/terminal/src/main/java/org/jline/terminal/impl/LineDisciplineTerminal.java similarity index 100% rename from src/main/java/org/jline/terminal/impl/LineDisciplineTerminal.java rename to terminal/src/main/java/org/jline/terminal/impl/LineDisciplineTerminal.java diff --git a/src/main/java/org/jline/terminal/impl/MouseSupport.java b/terminal/src/main/java/org/jline/terminal/impl/MouseSupport.java similarity index 98% rename from src/main/java/org/jline/terminal/impl/MouseSupport.java rename to terminal/src/main/java/org/jline/terminal/impl/MouseSupport.java index 78f9bb781..b3348c271 100644 --- a/src/main/java/org/jline/terminal/impl/MouseSupport.java +++ b/terminal/src/main/java/org/jline/terminal/impl/MouseSupport.java @@ -19,10 +19,6 @@ public class MouseSupport { - public enum Tracking { - Normal, Button, Any - } - public static boolean hasMouseSupport(Terminal terminal) { return terminal.getStringCapability(InfoCmp.Capability.key_mouse) != null; } diff --git a/src/main/java/org/jline/terminal/impl/NativeSignalHandler.java b/terminal/src/main/java/org/jline/terminal/impl/NativeSignalHandler.java similarity index 100% rename from src/main/java/org/jline/terminal/impl/NativeSignalHandler.java rename to terminal/src/main/java/org/jline/terminal/impl/NativeSignalHandler.java diff --git a/src/main/java/org/jline/terminal/impl/PosixPtyTerminal.java b/terminal/src/main/java/org/jline/terminal/impl/PosixPtyTerminal.java similarity index 99% rename from src/main/java/org/jline/terminal/impl/PosixPtyTerminal.java rename to terminal/src/main/java/org/jline/terminal/impl/PosixPtyTerminal.java index c2005ddc6..12bb98910 100644 --- a/src/main/java/org/jline/terminal/impl/PosixPtyTerminal.java +++ b/terminal/src/main/java/org/jline/terminal/impl/PosixPtyTerminal.java @@ -16,6 +16,7 @@ import java.util.Objects; import java.util.concurrent.atomic.AtomicBoolean; +import org.jline.terminal.spi.Pty; import org.jline.utils.ClosedException; import org.jline.utils.InputStreamReader; import org.jline.utils.NonBlockingReader; diff --git a/src/main/java/org/jline/terminal/impl/PosixSysTerminal.java b/terminal/src/main/java/org/jline/terminal/impl/PosixSysTerminal.java similarity index 98% rename from src/main/java/org/jline/terminal/impl/PosixSysTerminal.java rename to terminal/src/main/java/org/jline/terminal/impl/PosixSysTerminal.java index 1660d549d..46d1cf136 100644 --- a/src/main/java/org/jline/terminal/impl/PosixSysTerminal.java +++ b/terminal/src/main/java/org/jline/terminal/impl/PosixSysTerminal.java @@ -17,6 +17,7 @@ import java.util.Map; import java.util.Objects; +import org.jline.terminal.spi.Pty; import org.jline.utils.InputStreamReader; import org.jline.utils.NonBlockingReader; import org.jline.utils.ShutdownHooks; diff --git a/src/main/java/org/jline/terminal/impl/package-info.java b/terminal/src/main/java/org/jline/terminal/impl/package-info.java similarity index 100% rename from src/main/java/org/jline/terminal/impl/package-info.java rename to terminal/src/main/java/org/jline/terminal/impl/package-info.java diff --git a/terminal/src/main/java/org/jline/terminal/spi/JansiSupport.java b/terminal/src/main/java/org/jline/terminal/spi/JansiSupport.java new file mode 100644 index 000000000..d2d54b0c7 --- /dev/null +++ b/terminal/src/main/java/org/jline/terminal/spi/JansiSupport.java @@ -0,0 +1,11 @@ +package org.jline.terminal.spi; + +import org.jline.terminal.Terminal; + +import java.io.IOException; + +public interface JansiSupport { + + Terminal winSysTerminal(String name, boolean nativeSignals, Terminal.SignalHandler signalHandler) throws IOException; + +} diff --git a/terminal/src/main/java/org/jline/terminal/spi/JnaSupport.java b/terminal/src/main/java/org/jline/terminal/spi/JnaSupport.java new file mode 100644 index 000000000..557a76923 --- /dev/null +++ b/terminal/src/main/java/org/jline/terminal/spi/JnaSupport.java @@ -0,0 +1,17 @@ +package org.jline.terminal.spi; + +import org.jline.terminal.Attributes; +import org.jline.terminal.Size; +import org.jline.terminal.Terminal; + +import java.io.IOException; + +public interface JnaSupport { + + Pty current() throws IOException; + + Pty open(Attributes attributes, Size size) throws IOException; + + Terminal winSysTerminal(String name, boolean nativeSignals, Terminal.SignalHandler signalHandler) throws IOException; + +} diff --git a/src/main/java/org/jline/terminal/impl/Pty.java b/terminal/src/main/java/org/jline/terminal/spi/Pty.java similarity index 96% rename from src/main/java/org/jline/terminal/impl/Pty.java rename to terminal/src/main/java/org/jline/terminal/spi/Pty.java index b172f241c..7b2a54928 100644 --- a/src/main/java/org/jline/terminal/impl/Pty.java +++ b/terminal/src/main/java/org/jline/terminal/spi/Pty.java @@ -6,7 +6,7 @@ * * http://www.opensource.org/licenses/bsd-license.php */ -package org.jline.terminal.impl; +package org.jline.terminal.spi; import java.io.Closeable; import java.io.IOException; diff --git a/src/main/java/org/jline/utils/AttributedCharSequence.java b/terminal/src/main/java/org/jline/utils/AttributedCharSequence.java similarity index 100% rename from src/main/java/org/jline/utils/AttributedCharSequence.java rename to terminal/src/main/java/org/jline/utils/AttributedCharSequence.java diff --git a/src/main/java/org/jline/utils/AttributedString.java b/terminal/src/main/java/org/jline/utils/AttributedString.java similarity index 100% rename from src/main/java/org/jline/utils/AttributedString.java rename to terminal/src/main/java/org/jline/utils/AttributedString.java diff --git a/src/main/java/org/jline/utils/AttributedStringBuilder.java b/terminal/src/main/java/org/jline/utils/AttributedStringBuilder.java similarity index 100% rename from src/main/java/org/jline/utils/AttributedStringBuilder.java rename to terminal/src/main/java/org/jline/utils/AttributedStringBuilder.java diff --git a/src/main/java/org/jline/utils/AttributedStyle.java b/terminal/src/main/java/org/jline/utils/AttributedStyle.java similarity index 100% rename from src/main/java/org/jline/utils/AttributedStyle.java rename to terminal/src/main/java/org/jline/utils/AttributedStyle.java diff --git a/src/main/java/org/jline/utils/ClosedException.java b/terminal/src/main/java/org/jline/utils/ClosedException.java similarity index 100% rename from src/main/java/org/jline/utils/ClosedException.java rename to terminal/src/main/java/org/jline/utils/ClosedException.java diff --git a/src/main/java/org/jline/utils/Curses.java b/terminal/src/main/java/org/jline/utils/Curses.java similarity index 100% rename from src/main/java/org/jline/utils/Curses.java rename to terminal/src/main/java/org/jline/utils/Curses.java diff --git a/src/main/java/org/jline/utils/DiffHelper.java b/terminal/src/main/java/org/jline/utils/DiffHelper.java similarity index 100% rename from src/main/java/org/jline/utils/DiffHelper.java rename to terminal/src/main/java/org/jline/utils/DiffHelper.java diff --git a/src/main/java/org/jline/utils/Display.java b/terminal/src/main/java/org/jline/utils/Display.java similarity index 100% rename from src/main/java/org/jline/utils/Display.java rename to terminal/src/main/java/org/jline/utils/Display.java diff --git a/src/main/java/org/jline/utils/ExecHelper.java b/terminal/src/main/java/org/jline/utils/ExecHelper.java similarity index 100% rename from src/main/java/org/jline/utils/ExecHelper.java rename to terminal/src/main/java/org/jline/utils/ExecHelper.java diff --git a/src/main/java/org/jline/utils/InfoCmp.java b/terminal/src/main/java/org/jline/utils/InfoCmp.java similarity index 100% rename from src/main/java/org/jline/utils/InfoCmp.java rename to terminal/src/main/java/org/jline/utils/InfoCmp.java diff --git a/src/main/java/org/jline/utils/InputStreamReader.java b/terminal/src/main/java/org/jline/utils/InputStreamReader.java similarity index 100% rename from src/main/java/org/jline/utils/InputStreamReader.java rename to terminal/src/main/java/org/jline/utils/InputStreamReader.java diff --git a/src/main/java/org/jline/utils/Levenshtein.java b/terminal/src/main/java/org/jline/utils/Levenshtein.java similarity index 100% rename from src/main/java/org/jline/utils/Levenshtein.java rename to terminal/src/main/java/org/jline/utils/Levenshtein.java diff --git a/src/main/java/org/jline/utils/Log.java b/terminal/src/main/java/org/jline/utils/Log.java similarity index 100% rename from src/main/java/org/jline/utils/Log.java rename to terminal/src/main/java/org/jline/utils/Log.java diff --git a/src/main/java/org/jline/utils/NonBlockingReader.java b/terminal/src/main/java/org/jline/utils/NonBlockingReader.java similarity index 100% rename from src/main/java/org/jline/utils/NonBlockingReader.java rename to terminal/src/main/java/org/jline/utils/NonBlockingReader.java diff --git a/src/main/java/org/jline/utils/OSUtils.java b/terminal/src/main/java/org/jline/utils/OSUtils.java similarity index 100% rename from src/main/java/org/jline/utils/OSUtils.java rename to terminal/src/main/java/org/jline/utils/OSUtils.java diff --git a/src/main/java/org/jline/utils/ShutdownHooks.java b/terminal/src/main/java/org/jline/utils/ShutdownHooks.java similarity index 100% rename from src/main/java/org/jline/utils/ShutdownHooks.java rename to terminal/src/main/java/org/jline/utils/ShutdownHooks.java diff --git a/src/main/java/org/jline/utils/Signals.java b/terminal/src/main/java/org/jline/utils/Signals.java similarity index 100% rename from src/main/java/org/jline/utils/Signals.java rename to terminal/src/main/java/org/jline/utils/Signals.java diff --git a/src/main/java/org/jline/utils/WCWidth.java b/terminal/src/main/java/org/jline/utils/WCWidth.java similarity index 100% rename from src/main/java/org/jline/utils/WCWidth.java rename to terminal/src/main/java/org/jline/utils/WCWidth.java diff --git a/src/main/java/org/jline/utils/package-info.java b/terminal/src/main/java/org/jline/utils/package-info.java similarity index 100% rename from src/main/java/org/jline/utils/package-info.java rename to terminal/src/main/java/org/jline/utils/package-info.java diff --git a/src/main/resources/org/jline/utils/ansi.caps b/terminal/src/main/resources/org/jline/utils/ansi.caps similarity index 100% rename from src/main/resources/org/jline/utils/ansi.caps rename to terminal/src/main/resources/org/jline/utils/ansi.caps diff --git a/src/main/resources/org/jline/utils/capabilities.txt b/terminal/src/main/resources/org/jline/utils/capabilities.txt similarity index 100% rename from src/main/resources/org/jline/utils/capabilities.txt rename to terminal/src/main/resources/org/jline/utils/capabilities.txt diff --git a/src/main/resources/org/jline/utils/dumb.caps b/terminal/src/main/resources/org/jline/utils/dumb.caps similarity index 100% rename from src/main/resources/org/jline/utils/dumb.caps rename to terminal/src/main/resources/org/jline/utils/dumb.caps diff --git a/src/main/resources/org/jline/utils/screen-256color.caps b/terminal/src/main/resources/org/jline/utils/screen-256color.caps similarity index 100% rename from src/main/resources/org/jline/utils/screen-256color.caps rename to terminal/src/main/resources/org/jline/utils/screen-256color.caps diff --git a/src/main/resources/org/jline/utils/screen.caps b/terminal/src/main/resources/org/jline/utils/screen.caps similarity index 100% rename from src/main/resources/org/jline/utils/screen.caps rename to terminal/src/main/resources/org/jline/utils/screen.caps diff --git a/src/main/resources/org/jline/utils/windows.caps b/terminal/src/main/resources/org/jline/utils/windows.caps similarity index 100% rename from src/main/resources/org/jline/utils/windows.caps rename to terminal/src/main/resources/org/jline/utils/windows.caps diff --git a/src/main/resources/org/jline/utils/xterm-256color.caps b/terminal/src/main/resources/org/jline/utils/xterm-256color.caps similarity index 100% rename from src/main/resources/org/jline/utils/xterm-256color.caps rename to terminal/src/main/resources/org/jline/utils/xterm-256color.caps diff --git a/src/main/resources/org/jline/utils/xterm.caps b/terminal/src/main/resources/org/jline/utils/xterm.caps similarity index 100% rename from src/main/resources/org/jline/utils/xterm.caps rename to terminal/src/main/resources/org/jline/utils/xterm.caps diff --git a/src/test/java/org/jline/terminal/impl/ExecPtyTest.java b/terminal/src/test/java/org/jline/terminal/impl/ExecPtyTest.java similarity index 100% rename from src/test/java/org/jline/terminal/impl/ExecPtyTest.java rename to terminal/src/test/java/org/jline/terminal/impl/ExecPtyTest.java diff --git a/src/test/java/org/jline/terminal/impl/PosixSysTerminalTest.java b/terminal/src/test/java/org/jline/terminal/impl/PosixSysTerminalTest.java similarity index 98% rename from src/test/java/org/jline/terminal/impl/PosixSysTerminalTest.java rename to terminal/src/test/java/org/jline/terminal/impl/PosixSysTerminalTest.java index a42508732..b4154a17a 100644 --- a/src/test/java/org/jline/terminal/impl/PosixSysTerminalTest.java +++ b/terminal/src/test/java/org/jline/terminal/impl/PosixSysTerminalTest.java @@ -12,6 +12,7 @@ import org.jline.terminal.Attributes; import org.jline.terminal.Terminal.Signal; import org.jline.terminal.Terminal.SignalHandler; +import org.jline.terminal.spi.Pty; import org.junit.Test; import java.io.ByteArrayInputStream; diff --git a/src/test/java/org/jline/utils/AttributedStringTest.java b/terminal/src/test/java/org/jline/utils/AttributedStringTest.java similarity index 100% rename from src/test/java/org/jline/utils/AttributedStringTest.java rename to terminal/src/test/java/org/jline/utils/AttributedStringTest.java diff --git a/src/test/java/org/jline/utils/CursesTest.java b/terminal/src/test/java/org/jline/utils/CursesTest.java similarity index 100% rename from src/test/java/org/jline/utils/CursesTest.java rename to terminal/src/test/java/org/jline/utils/CursesTest.java diff --git a/src/test/java/org/jline/utils/InfoCmpTest.java b/terminal/src/test/java/org/jline/utils/InfoCmpTest.java similarity index 100% rename from src/test/java/org/jline/utils/InfoCmpTest.java rename to terminal/src/test/java/org/jline/utils/InfoCmpTest.java