pygments-shell-console 0.7.3__tar.gz → 0.8.1__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.3 → pygments_shell_console-0.8.1}/PKG-INFO +1 -1
- {pygments_shell_console-0.7.3 → pygments_shell_console-0.8.1}/pyproject.toml +1 -1
- {pygments_shell_console-0.7.3 → pygments_shell_console-0.8.1}/shellconsole_lexer.py +4 -4
- {pygments_shell_console-0.7.3 → pygments_shell_console-0.8.1}/test/test_prompts.py +25 -0
- {pygments_shell_console-0.7.3 → pygments_shell_console-0.8.1}/.github/workflows/publish-to-pypi.yml +0 -0
- {pygments_shell_console-0.7.3 → pygments_shell_console-0.8.1}/.gitignore +0 -0
- {pygments_shell_console-0.7.3 → pygments_shell_console-0.8.1}/README.md +0 -0
- {pygments_shell_console-0.7.3 → pygments_shell_console-0.8.1}/examples/git_lg.example +0 -0
- {pygments_shell_console-0.7.3 → pygments_shell_console-0.8.1}/examples/git_log.example +0 -0
- {pygments_shell_console-0.7.3 → pygments_shell_console-0.8.1}/examples/git_show.example +0 -0
- {pygments_shell_console-0.7.3 → pygments_shell_console-0.8.1}/examples/status.example +0 -0
- {pygments_shell_console-0.7.3 → pygments_shell_console-0.8.1}/examples/test.exmpl +0 -0
- {pygments_shell_console-0.7.3 → pygments_shell_console-0.8.1}/examples/test.sh +0 -0
- {pygments_shell_console-0.7.3 → pygments_shell_console-0.8.1}/git_lexer.py +0 -0
- {pygments_shell_console-0.7.3 → pygments_shell_console-0.8.1}/shellconsole_style.py +0 -0
- {pygments_shell_console-0.7.3 → pygments_shell_console-0.8.1}/test/__init__.py +0 -0
- {pygments_shell_console-0.7.3 → pygments_shell_console-0.8.1}/test/test_git.py +0 -0
- {pygments_shell_console-0.7.3 → pygments_shell_console-0.8.1}/test/test_git_branch.py +0 -0
- {pygments_shell_console-0.7.3 → pygments_shell_console-0.8.1}/test/test_git_log.py +0 -0
- {pygments_shell_console-0.7.3 → pygments_shell_console-0.8.1}/test/test_git_merge.py +0 -0
- {pygments_shell_console-0.7.3 → pygments_shell_console-0.8.1}/test/test_git_pretty_log.py +0 -0
- {pygments_shell_console-0.7.3 → pygments_shell_console-0.8.1}/test/test_git_show.py +0 -0
- {pygments_shell_console-0.7.3 → pygments_shell_console-0.8.1}/test/test_git_status.py +0 -0
|
@@ -38,15 +38,15 @@ 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
|
|
49
|
-
r'([
|
|
49
|
+
r'((?:[$%]|(?:(?<!^)#))\n?)', # End of prompt
|
|
50
50
|
r'(\s*)', # Whitespace
|
|
51
51
|
r'(?P<command>.*\n?)' # Command
|
|
52
52
|
]
|
|
@@ -2,6 +2,31 @@ 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
|
+
|
|
20
|
+
def test_empty_root_bash_prompt_not_allowed():
|
|
21
|
+
lexer = ShellConsoleLexer()
|
|
22
|
+
prompt = "# echo Hello"
|
|
23
|
+
|
|
24
|
+
tokens = list(lexer.get_tokens(prompt))
|
|
25
|
+
|
|
26
|
+
assert tokens == [
|
|
27
|
+
(Token.Generic.Output, "# echo Hello\n"),
|
|
28
|
+
]
|
|
29
|
+
|
|
5
30
|
def test_basic_bash_prompt():
|
|
6
31
|
lexer = ShellConsoleLexer()
|
|
7
32
|
prompt = "user@host:~$"
|
{pygments_shell_console-0.7.3 → pygments_shell_console-0.8.1}/.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
|
|
File without changes
|