Refactor CLI internals for REPL shell

Numerous updates to the Spring CLI, primarily for better embedded REPL
shell support:

* Refactor the CLI application to help separate concerts between the
  main CLI and the embedded shell. Both the CLI and embedded shell now
  delegate to a new `CommandRunner` to handle running commands. The
  runner can be configured differently depending depending on need.
  For example, the embedded shell adds the 'prompt' and 'clear'
  commands.

* Most `Command` implementations have been moved to sub-packages so that
  they can be co-located with the classes that they use.

* Option commands are now only used in the CLI, the embedded shell
  does not user them and details have been removed from the Command
  interface.

* The REPL shell has been significantly refactored to:
    - Support CTRL-C to cancel the running process. This is supported
      when running external commands and most internal commands.
    - Fork a new JVM when running commands (primarily for CTRL-C support
      but also for potential memory and classpath issues)
    - Change the "continue" trigger from `<<` to `\`
    - Support command completion of files
    - Add ANSI color output
    - Provide 'help' support for internal commands (such as 'clear')
    - Remove the now redundant `stop` command

Fixes gh-227
This commit is contained in:
Phillip Webb
2014-01-14 15:06:03 -08:00
parent cad9fbfdf0
commit c8a1d8830c
48 changed files with 1693 additions and 922 deletions

View File

@@ -14,7 +14,6 @@
<main.basedir>${basedir}/..</main.basedir>
<start-class>org.springframework.boot.cli.SpringCli</start-class>
<spring.profiles.active>default</spring.profiles.active>
<jline.version>2.11</jline.version>
</properties>
<profiles>
<profile>
@@ -53,7 +52,6 @@
<dependency>
<groupId>jline</groupId>
<artifactId>jline</artifactId>
<version>${jline.version}</version>
</dependency>
<dependency>
<groupId>net.sf.jopt-simple</groupId>
@@ -320,7 +318,6 @@
<target>
<taskdef resource="net/sf/antcontrib/antcontrib.properties" />
<taskdef name="stringutil" classname="ise.antelope.tasks.StringUtilTask" />
<var name="version" value="${project.version}" />
<var name="version-type" value="${project.version}" />
<propertyregex property="version-type" override="true"
input="${version-type}" regexp=".*\.(.*)" replace="\1" />
@@ -332,10 +329,10 @@
<lowercase />
</stringutil>
<checksum algorithm="sha-1"
file="${project.build.directory}/spring-boot-cli-${version}-bin.tar.gz"
file="${project.build.directory}/spring-boot-cli-${project.version}-bin.tar.gz"
property="checksum" />
<echo
message="Customizing homebrew for ${version} with checksum ${checksum} in ${repo} repo" />
message="Customizing homebrew for ${project.version} with checksum ${checksum} in ${repo} repo" />
<copy file="${basedir}/src/main/homebrew/springboot.rb"
tofile="${project.build.directory}/springboot.rb" overwrite="true">
<filterchain>