This commit is contained in:
Phillip Webb
2014-01-02 12:04:45 -08:00
parent 0f9c705980
commit 1bcd3de7b5
31 changed files with 159 additions and 56 deletions

View File

@@ -1,3 +1,19 @@
/*
* Copyright 2012-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.boot.cli.command;
import java.io.IOException;

View File

@@ -1,6 +1,21 @@
/*
* Copyright 2012-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.boot.cli.command;
import org.springframework.boot.cli.command.AbstractCommand;
/**
* @author Dave Syer
@@ -10,7 +25,8 @@ public class PromptCommand extends AbstractCommand {
private final ShellCommand runCmd;
public PromptCommand(ShellCommand runCmd) {
super("prompt", "Change the prompt used with the current 'shell' command. Execute with no arguments to return to the previous value.");
super("prompt", "Change the prompt used with the current 'shell' command. "
+ "Execute with no arguments to return to the previous value.");
this.runCmd = runCmd;
}
@@ -18,10 +34,11 @@ public class PromptCommand extends AbstractCommand {
public void run(String... strings) throws Exception {
if (strings.length > 0) {
for (String string : strings) {
runCmd.pushPrompt(string + " ");
this.runCmd.pushPrompt(string + " ");
}
} else {
runCmd.popPrompt();
}
else {
this.runCmd.popPrompt();
}
}

View File

@@ -1,3 +1,19 @@
/*
* Copyright 2012-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.boot.cli.command;
import java.io.IOException;
@@ -12,7 +28,8 @@ public class Shell {
public static void main(String... args) throws IOException {
if (args.length == 0) {
SpringCli.main("shell"); // right into the REPL by default
} else {
}
else {
SpringCli.main(args);
}
}

View File

@@ -1,3 +1,19 @@
/*
* Copyright 2012-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.boot.cli.command;
import java.io.IOException;
@@ -26,8 +42,11 @@ import org.springframework.util.StringUtils;
public class ShellCommand extends AbstractCommand {
private String defaultPrompt = "$ ";
private SpringCli springCli;
private String prompt = this.defaultPrompt;
private Stack<String> prompts = new Stack<String>();
public ShellCommand(SpringCli springCli) {
@@ -186,8 +205,8 @@ public class ShellCommand extends AbstractCommand {
String version = ShellCommand.class.getPackage().getImplementationVersion();
version = (version == null ? "" : " (v" + version + ")");
System.out.println("Spring Boot CLI" + version);
System.out
.println("Hit TAB to complete. Type 'help' and hit RETURN for help, and 'quit' to exit.");
System.out.println("Hit TAB to complete. Type 'help' and hit "
+ "RETURN for help, and 'quit' to exit.");
}
public void pushPrompt(String prompt) {

View File

@@ -1,7 +1,21 @@
/*
* Copyright 2012-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.boot.cli.command;
import org.springframework.boot.cli.command.AbstractCommand;
import org.springframework.boot.cli.command.RunCommand;
/**
* @author Jon Brisbin
@@ -11,13 +25,14 @@ public class StopCommand extends AbstractCommand {
private final RunCommand runCmd;
public StopCommand(RunCommand runCmd) {
super("stop", "Stop the currently-running application started with the 'run' command.");
super("stop",
"Stop the currently-running application started with the 'run' command.");
this.runCmd = runCmd;
}
@Override
public void run(String... strings) throws Exception {
runCmd.stop();
this.runCmd.stop();
}
}

View File

@@ -47,6 +47,7 @@ public final class JreProxySelector implements ProxySelector {
public JreProxySelector() {
}
@Override
public Proxy getProxy(RemoteRepository repository) {
List<java.net.Proxy> proxies = null;
try {
@@ -95,6 +96,7 @@ public final class JreProxySelector implements ProxySelector {
public static final Authentication INSTANCE = new JreProxyAuthentication();
@Override
public void fill(AuthenticationContext context, String key,
Map<String, String> data) {
Proxy proxy = context.getProxy();
@@ -136,6 +138,7 @@ public final class JreProxySelector implements ProxySelector {
}
}
@Override
public void digest(AuthenticationDigest digest) {
// we don't know anything about the JRE's current authenticator, assume the
// worst (i.e. interactive)