Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for more complex command prompts (#583)
The bashsession lexer did only recognized command prompts starting with one of the characters '#$%>'. This commit adds support for a prefixed block of the form `[.*@.*]`, which is a common layout for command prompts.
- Loading branch information
Showing
3 changed files
with
51 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,56 @@ | ||
[ | ||
{"type":"GenericPrompt","value":"$ "}, | ||
{"type":"GenericPrompt","value":"$"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"NameBuiltin","value":"echo"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"LiteralStringDouble","value":"\"Hello, world!\""}, | ||
{"type":"Text","value":"\n"}, | ||
{"type":"GenericOutput","value":"Hello, world!\n"}, | ||
{"type":"GenericPrompt","value":"%\t"}, | ||
{"type":"GenericPrompt","value":"%"}, | ||
{"type":"Text","value":"\t"}, | ||
{"type":"NameBuiltin","value":"pwd"}, | ||
{"type":"Text","value":"\n"}, | ||
{"type":"GenericOutput","value":"/User/foo\n"}, | ||
{"type":"GenericPrompt","value":"> "}, | ||
{"type":"Text","value":"make -j build\n"}, | ||
{"type":"GenericPrompt","value":"\u003e"}, | ||
{"type":"Text","value":" make -j build\n"}, | ||
{"type":"GenericPrompt","value":"%"}, | ||
{"type":"Text","value":"ls "}, | ||
{"type":"Punctuation","value":"|"}, | ||
{"type":"Text","value":" wc -l\n"}, | ||
{"type":"GenericOutput","value":"5\n"} | ||
{"type":"GenericOutput","value":"5\n"}, | ||
{"type":"GenericPrompt","value":"[user@host]$"}, | ||
{"type":"Text","value":" whoami\n"}, | ||
{"type":"GenericOutput","value":"user\n"}, | ||
{"type":"GenericPrompt","value":"[user@host] #"}, | ||
{"type":"Text","value":" id\n"}, | ||
{"type":"GenericOutput","value":"uid=1000(user) gid=1000(user) groups=1000(user)\n"}, | ||
{"type":"GenericPrompt","value":"[super user :D@super host :D] %"}, | ||
{"type":"Keyword","value":"if"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Operator","value":"["}, | ||
{"type":"Text","value":" "}, | ||
{"type":"LiteralNumber","value":"1"}, | ||
{"type":"Text","value":" -eq "}, | ||
{"type":"LiteralNumber","value":"1"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Operator","value":"]"}, | ||
{"type":"Punctuation","value":";"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Keyword","value":"then"}, | ||
{"type":"Text","value":" uname"}, | ||
{"type":"Punctuation","value":";"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Keyword","value":"fi"}, | ||
{"type":"Text","value":"\n"}, | ||
{"type":"GenericOutput","value":"Linux\n"}, | ||
{"type":"GenericPrompt","value":"[user@host]%"}, | ||
{"type":"NameBuiltin","value":"echo"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Keyword","value":"$(("}, | ||
{"type":"LiteralNumber","value":"1"}, | ||
{"type":"Operator","value":"+"}, | ||
{"type":"LiteralNumber","value":"1"}, | ||
{"type":"Keyword","value":"))"}, | ||
{"type":"Text","value":"\n"}, | ||
{"type":"GenericOutput","value":"2\n"} | ||
] |