File tree 1 file changed +11
-1
lines changed
spring-shell-core/src/main/java/org/springframework/shell/jline
1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -66,7 +66,13 @@ public Input readInput() {
66
66
if (line == null ) {
67
67
return null ;
68
68
} else {
69
- ParsedLine parsedLine = parser .parse (sb .toString (), sb .toString ().length ());
69
+ // gh-277: if it's a commented line then skip as it is equal to NO_INPUT
70
+ ParsedLine parsedLine ;
71
+ if (isCommentedLine (line )) {
72
+ parsedLine = parser .parse ("" , -1 , Parser .ParseContext .COMPLETE );
73
+ } else {
74
+ parsedLine = parser .parse (sb .toString (), sb .toString ().length ());
75
+ }
70
76
return new ParsedLineInput (parsedLine );
71
77
}
72
78
}
@@ -75,4 +81,8 @@ public Input readInput() {
75
81
public void close () throws IOException {
76
82
reader .close ();
77
83
}
84
+
85
+ private boolean isCommentedLine (String line ) {
86
+ return line .matches ("\\ s*//.*" );
87
+ }
78
88
}
You can’t perform that action at this time.
0 commit comments