pygments-shell-console 0.7.2__tar.gz → 0.8.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pygments_shell_console-0.7.2 → pygments_shell_console-0.8.0}/PKG-INFO +1 -1
- {pygments_shell_console-0.7.2 → pygments_shell_console-0.8.0}/git_lexer.py +1 -1
- {pygments_shell_console-0.7.2 → pygments_shell_console-0.8.0}/pyproject.toml +1 -1
- {pygments_shell_console-0.7.2 → pygments_shell_console-0.8.0}/shellconsole_lexer.py +3 -3
- {pygments_shell_console-0.7.2 → pygments_shell_console-0.8.0}/test/test_prompts.py +15 -0
- {pygments_shell_console-0.7.2 → pygments_shell_console-0.8.0}/.github/workflows/publish-to-pypi.yml +0 -0
- {pygments_shell_console-0.7.2 → pygments_shell_console-0.8.0}/.gitignore +0 -0
- {pygments_shell_console-0.7.2 → pygments_shell_console-0.8.0}/README.md +0 -0
- {pygments_shell_console-0.7.2 → pygments_shell_console-0.8.0}/examples/git_lg.example +0 -0
- {pygments_shell_console-0.7.2 → pygments_shell_console-0.8.0}/examples/git_log.example +0 -0
- {pygments_shell_console-0.7.2 → pygments_shell_console-0.8.0}/examples/git_show.example +0 -0
- {pygments_shell_console-0.7.2 → pygments_shell_console-0.8.0}/examples/status.example +0 -0
- {pygments_shell_console-0.7.2 → pygments_shell_console-0.8.0}/examples/test.exmpl +0 -0
- {pygments_shell_console-0.7.2 → pygments_shell_console-0.8.0}/examples/test.sh +0 -0
- {pygments_shell_console-0.7.2 → pygments_shell_console-0.8.0}/shellconsole_style.py +0 -0
- {pygments_shell_console-0.7.2 → pygments_shell_console-0.8.0}/test/__init__.py +0 -0
- {pygments_shell_console-0.7.2 → pygments_shell_console-0.8.0}/test/test_git.py +0 -0
- {pygments_shell_console-0.7.2 → pygments_shell_console-0.8.0}/test/test_git_branch.py +0 -0
- {pygments_shell_console-0.7.2 → pygments_shell_console-0.8.0}/test/test_git_log.py +0 -0
- {pygments_shell_console-0.7.2 → pygments_shell_console-0.8.0}/test/test_git_merge.py +0 -0
- {pygments_shell_console-0.7.2 → pygments_shell_console-0.8.0}/test/test_git_pretty_log.py +0 -0
- {pygments_shell_console-0.7.2 → pygments_shell_console-0.8.0}/test/test_git_show.py +0 -0
- {pygments_shell_console-0.7.2 → pygments_shell_console-0.8.0}/test/test_git_status.py +0 -0
|
@@ -38,11 +38,11 @@ class ShellConsoleLexer(Lexer):
|
|
|
38
38
|
r'(?P<venv>\([^\)]*\))?', # Virtualenv
|
|
39
39
|
r'(\s*)?', # Whitespace
|
|
40
40
|
r'\[?', # Start bracketed prompt
|
|
41
|
-
r'(?P<user_host>[\S @]+@[^\s]+?)', # user@host
|
|
41
|
+
r'(?P<user_host>[\S @]+@[^\s]+?)?', # user@host
|
|
42
42
|
r'(\s*)', # Whitespace
|
|
43
|
-
r'(?:(\:)|(\s+))', # Separator: colon or space
|
|
43
|
+
r'(?:(\:)|(\s+))?', # Separator: colon or space
|
|
44
44
|
r'(\s*)', # Whitespace
|
|
45
|
-
r'(?P<current_dir>[^\s\]]+)', # Current directory
|
|
45
|
+
r'(?P<current_dir>[^\s\]:]+)?', # Current directory
|
|
46
46
|
r'(?:(\s+)(?P<git_branch>\([^)]+\)))?', # Whitespace + Git branch
|
|
47
47
|
r'\]?', # End bracketed prompt
|
|
48
48
|
r'(\s*)', # Whitespace
|
|
@@ -2,6 +2,21 @@ import pytest
|
|
|
2
2
|
from pygments.token import Token
|
|
3
3
|
from shellconsole_lexer import ShellConsoleLexer
|
|
4
4
|
|
|
5
|
+
def test_empty_bash_prompt():
|
|
6
|
+
lexer = ShellConsoleLexer()
|
|
7
|
+
prompt = "$ echo Hello"
|
|
8
|
+
|
|
9
|
+
tokens = list(lexer.get_tokens(prompt))
|
|
10
|
+
|
|
11
|
+
assert tokens == [
|
|
12
|
+
(Token.Generic.Prompt, "$"),
|
|
13
|
+
(Token.Generic.Prompt.Whitespace, " "),
|
|
14
|
+
(Token.Name.Builtin, "echo"),
|
|
15
|
+
(Token.Text.Whitespace, " "),
|
|
16
|
+
(Token.Text, "Hello"),
|
|
17
|
+
(Token.Text.Whitespace, "\n"),
|
|
18
|
+
]
|
|
19
|
+
|
|
5
20
|
def test_basic_bash_prompt():
|
|
6
21
|
lexer = ShellConsoleLexer()
|
|
7
22
|
prompt = "user@host:~$"
|
{pygments_shell_console-0.7.2 → pygments_shell_console-0.8.0}/.github/workflows/publish-to-pypi.yml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|