mirror of
https://github.com/jlengrand/picocli.git
synced 2026-03-10 08:41:17 +00:00
[#587] Enhance picocli-shell-jline3 example: update RELEASE-NOTES and README
This commit is contained in:
@@ -137,6 +137,7 @@ Support was added for the following environment variables to control enabling AN
|
||||
|
||||
## <a name="3.9.0-fixes"></a> Fixed issues
|
||||
- [#574] Add `picocli-shell-jline3` module. Thanks to [mattirn](https://github.com/mattirn) for the pull request.
|
||||
- [#587] Enhance `picocli-shell-jline3` example by using JLine's `DefaultParser` to split lines into arguments. Thanks to [mattirn](https://github.com/mattirn) for the pull request.
|
||||
- [#567] Usage message customization API initial implementation. Thanks to [Christian Helmer](https://github.com/SysLord) for the pull request.
|
||||
- [#530] Added API for easily customizing the usage help message. Thanks to [stechio](https://github.com/stechio) for raising the request and productive discussions.
|
||||
- [#569] Facilitate customization of the synopsis: split `Help.detailedSynopsis()` into protected methods.
|
||||
|
||||
@@ -44,6 +44,9 @@ import java.util.concurrent.TimeUnit;
|
||||
import org.jline.reader.Completer;
|
||||
import org.jline.reader.LineReader;
|
||||
import org.jline.reader.LineReaderBuilder;
|
||||
import org.jline.reader.EndOfFileException;
|
||||
import org.jline.reader.UserInterruptException;
|
||||
import org.jline.reader.ParsedLine;
|
||||
import org.jline.reader.impl.DefaultParser;
|
||||
import org.jline.reader.impl.LineReaderImpl;
|
||||
import org.jline.terminal.TerminalBuilder;
|
||||
@@ -143,15 +146,17 @@ public class Example {
|
||||
|
||||
// start the shell and process input until the user quits with Ctl-D
|
||||
String line;
|
||||
while (true) {
|
||||
while (true) {
|
||||
try {
|
||||
line = reader.readLine(prompt, rightPrompt, (MaskingCallback) null, null);
|
||||
CommandLine.run(commands, line.split("\\s+"));
|
||||
ParsedLine pl = reader.getParser().parse(line, 0);
|
||||
String[] arguments = pl.words().toArray(new String[0]);
|
||||
CommandLine.run(commands, arguments);
|
||||
} catch (UserInterruptException e) {
|
||||
// Ignore
|
||||
} catch (EndOfFileException e) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
|
||||
@@ -114,9 +114,8 @@ public class Example {
|
||||
try {
|
||||
line = reader.readLine(prompt, rightPrompt, (MaskingCallback) null, null);
|
||||
ParsedLine pl = reader.getParser().parse(line, 0);
|
||||
String[] _args = new String[pl.words().size()];
|
||||
_args = pl.words().toArray(_args);
|
||||
CommandLine.run(commands, _args);
|
||||
String[] arguments = pl.words().toArray(new String[0]);
|
||||
CommandLine.run(commands, arguments);
|
||||
} catch (UserInterruptException e) {
|
||||
// Ignore
|
||||
} catch (EndOfFileException e) {
|
||||
|
||||
Reference in New Issue
Block a user