File tree 3 files changed +12
-7
lines changed
console/src/main/java/org/jline/console/impl
3 files changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -837,8 +837,8 @@ private static class ArgsParser {
837
837
private boolean quoted ;
838
838
private boolean doubleQuoted ;
839
839
private String line ;
840
- private String command ;
841
- private String variable ;
840
+ private String command = "" ;
841
+ private String variable = "" ;
842
842
private List <String > args ;
843
843
private final Parser parser ;
844
844
@@ -926,11 +926,15 @@ public void parse(String line) {
926
926
this .line = line ;
927
927
ParsedLine pl = parser .parse (line , 0 , ParseContext .SPLIT_LINE );
928
928
enclosedArgs (pl .words ());
929
- this .command = parser .getCommand (args .get (0 ));
930
- if (!parser .validCommandName (command )) {
931
- this .command = "" ;
929
+ if (!args .isEmpty ()) {
930
+ this .command = parser .getCommand (args .get (0 ));
931
+ if (!parser .validCommandName (command )) {
932
+ this .command = "" ;
933
+ }
934
+ this .variable = parser .getVariable (args .get (0 ));
935
+ } else {
936
+ this .line = "" ;
932
937
}
933
- this .variable = parser .getVariable (args .get (0 ));
934
938
}
935
939
936
940
public String line () {
Original file line number Diff line number Diff line change @@ -247,6 +247,8 @@ public static void main(String[] args) {
247
247
parser .setEofOnUnclosedQuote (true );
248
248
parser .setEscapeChars (null );
249
249
parser .setRegexCommand ("[:]{0,1}[a-zA-Z!]{1,}\\ S*" ); // change default regex to support shell commands
250
+ parser .blockCommentDelims (new DefaultParser .BlockCommentDelims ("/*" , "*/" ))
251
+ .lineCommentDelims (new String []{"//" , "#" });
250
252
Terminal terminal = TerminalBuilder .builder ().build ();
251
253
if (terminal .getWidth () == 0 || terminal .getHeight () == 0 ) {
252
254
terminal .setSize (new Size (120 , 40 )); // hard coded terminal size when redirecting
Original file line number Diff line number Diff line change @@ -96,7 +96,6 @@ pipe |:: '.collectMany{' '}'
96
96
pipe |? '.findAll{' '}'
97
97
pipe |?1 '.find{' '}'
98
98
pipe |! '.each{' '}'
99
- pipe |# '.take(' ')'
100
99
pipe |& '.' ' '
101
100
pipe grep '.collect{it.toString()}.findAll{it=~/' '/}'
102
101
alias null '|& identity{}'
You can’t perform that action at this time.
0 commit comments