pygments-shell-console 0.8.0__tar.gz → 0.8.2__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.8.0 → pygments_shell_console-0.8.2}/PKG-INFO +1 -1
- {pygments_shell_console-0.8.0 → pygments_shell_console-0.8.2}/pyproject.toml +1 -1
- {pygments_shell_console-0.8.0 → pygments_shell_console-0.8.2}/shellconsole_lexer.py +7 -3
- {pygments_shell_console-0.8.0 → pygments_shell_console-0.8.2}/test/test_prompts.py +20 -0
- {pygments_shell_console-0.8.0 → pygments_shell_console-0.8.2}/.github/workflows/publish-to-pypi.yml +0 -0
- {pygments_shell_console-0.8.0 → pygments_shell_console-0.8.2}/.gitignore +0 -0
- {pygments_shell_console-0.8.0 → pygments_shell_console-0.8.2}/README.md +0 -0
- {pygments_shell_console-0.8.0 → pygments_shell_console-0.8.2}/examples/git_lg.example +0 -0
- {pygments_shell_console-0.8.0 → pygments_shell_console-0.8.2}/examples/git_log.example +0 -0
- {pygments_shell_console-0.8.0 → pygments_shell_console-0.8.2}/examples/git_show.example +0 -0
- {pygments_shell_console-0.8.0 → pygments_shell_console-0.8.2}/examples/status.example +0 -0
- {pygments_shell_console-0.8.0 → pygments_shell_console-0.8.2}/examples/test.exmpl +0 -0
- {pygments_shell_console-0.8.0 → pygments_shell_console-0.8.2}/examples/test.sh +0 -0
- {pygments_shell_console-0.8.0 → pygments_shell_console-0.8.2}/git_lexer.py +0 -0
- {pygments_shell_console-0.8.0 → pygments_shell_console-0.8.2}/shellconsole_style.py +0 -0
- {pygments_shell_console-0.8.0 → pygments_shell_console-0.8.2}/test/__init__.py +0 -0
- {pygments_shell_console-0.8.0 → pygments_shell_console-0.8.2}/test/test_git.py +0 -0
- {pygments_shell_console-0.8.0 → pygments_shell_console-0.8.2}/test/test_git_branch.py +0 -0
- {pygments_shell_console-0.8.0 → pygments_shell_console-0.8.2}/test/test_git_log.py +0 -0
- {pygments_shell_console-0.8.0 → pygments_shell_console-0.8.2}/test/test_git_merge.py +0 -0
- {pygments_shell_console-0.8.0 → pygments_shell_console-0.8.2}/test/test_git_pretty_log.py +0 -0
- {pygments_shell_console-0.8.0 → pygments_shell_console-0.8.2}/test/test_git_show.py +0 -0
- {pygments_shell_console-0.8.0 → pygments_shell_console-0.8.2}/test/test_git_status.py +0 -0
|
@@ -38,15 +38,19 @@ class ShellConsoleLexer(Lexer):
|
|
|
38
38
|
r'(?P<venv>\([^\)]*\))?', # Virtualenv
|
|
39
39
|
r'(\s*)?', # Whitespace
|
|
40
40
|
r'\[?', # Start bracketed prompt
|
|
41
|
-
|
|
41
|
+
|
|
42
|
+
r'(?:', # Start of user@host:directory
|
|
43
|
+
r'(?P<user_host>[^\n$%#]+@[^\s$%#]+?)', # user@host
|
|
42
44
|
r'(\s*)', # Whitespace
|
|
43
45
|
r'(?:(\:)|(\s+))?', # Separator: colon or space
|
|
44
46
|
r'(\s*)', # Whitespace
|
|
45
|
-
r'(?P<current_dir>[^\s\]
|
|
47
|
+
r'(?P<current_dir>[^\s\]:$%#]+)', # Current directory
|
|
48
|
+
r')?', # End of user@host:directory
|
|
49
|
+
|
|
46
50
|
r'(?:(\s+)(?P<git_branch>\([^)]+\)))?', # Whitespace + Git branch
|
|
47
51
|
r'\]?', # End bracketed prompt
|
|
48
52
|
r'(\s*)', # Whitespace
|
|
49
|
-
r'([
|
|
53
|
+
r'((?:[$%]|(?<=user_host):\s*#)\n?)',
|
|
50
54
|
r'(\s*)', # Whitespace
|
|
51
55
|
r'(?P<command>.*\n?)' # Command
|
|
52
56
|
]
|
|
@@ -17,6 +17,26 @@ def test_empty_bash_prompt():
|
|
|
17
17
|
(Token.Text.Whitespace, "\n"),
|
|
18
18
|
]
|
|
19
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
|
+
|
|
30
|
+
def test_multiple_hashtag_with_spaces():
|
|
31
|
+
lexer = ShellConsoleLexer()
|
|
32
|
+
prompt = " ## echo Hello"
|
|
33
|
+
|
|
34
|
+
tokens = list(lexer.get_tokens(prompt))
|
|
35
|
+
|
|
36
|
+
assert tokens == [
|
|
37
|
+
(Token.Generic.Output, " ## echo Hello\n"),
|
|
38
|
+
]
|
|
39
|
+
|
|
20
40
|
def test_basic_bash_prompt():
|
|
21
41
|
lexer = ShellConsoleLexer()
|
|
22
42
|
prompt = "user@host:~$"
|
{pygments_shell_console-0.8.0 → pygments_shell_console-0.8.2}/.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
|