pygments-shell-console 0.4__tar.gz → 0.5.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.4 → pygments_shell_console-0.5.0}/PKG-INFO +1 -1
- {pygments_shell_console-0.4 → pygments_shell_console-0.5.0}/git_lexer.py +6 -0
- {pygments_shell_console-0.4 → pygments_shell_console-0.5.0}/pyproject.toml +1 -1
- {pygments_shell_console-0.4 → pygments_shell_console-0.5.0}/test/test_git.py +85 -1
- {pygments_shell_console-0.4 → pygments_shell_console-0.5.0}/.github/workflows/publish-to-pypi.yml +0 -0
- {pygments_shell_console-0.4 → pygments_shell_console-0.5.0}/.gitignore +0 -0
- {pygments_shell_console-0.4 → pygments_shell_console-0.5.0}/README.md +0 -0
- {pygments_shell_console-0.4 → pygments_shell_console-0.5.0}/examples/git_lg.example +0 -0
- {pygments_shell_console-0.4 → pygments_shell_console-0.5.0}/examples/git_log.example +0 -0
- {pygments_shell_console-0.4 → pygments_shell_console-0.5.0}/examples/git_show.example +0 -0
- {pygments_shell_console-0.4 → pygments_shell_console-0.5.0}/examples/status.example +0 -0
- {pygments_shell_console-0.4 → pygments_shell_console-0.5.0}/examples/test.exmpl +0 -0
- {pygments_shell_console-0.4 → pygments_shell_console-0.5.0}/examples/test.sh +0 -0
- {pygments_shell_console-0.4 → pygments_shell_console-0.5.0}/shellconsole_lexer.py +0 -0
- {pygments_shell_console-0.4 → pygments_shell_console-0.5.0}/shellconsole_style.py +0 -0
- {pygments_shell_console-0.4 → pygments_shell_console-0.5.0}/test/__init__.py +0 -0
- {pygments_shell_console-0.4 → pygments_shell_console-0.5.0}/test/test_git_branch.py +0 -0
- {pygments_shell_console-0.4 → pygments_shell_console-0.5.0}/test/test_git_log.py +0 -0
- {pygments_shell_console-0.4 → pygments_shell_console-0.5.0}/test/test_git_pretty_log.py +0 -0
- {pygments_shell_console-0.4 → pygments_shell_console-0.5.0}/test/test_git_show.py +0 -0
- {pygments_shell_console-0.4 → pygments_shell_console-0.5.0}/test/test_git_status.py +0 -0
- {pygments_shell_console-0.4 → pygments_shell_console-0.5.0}/test/test_prompts.py +0 -0
|
@@ -26,6 +26,9 @@ STANDARD_TYPES.update({
|
|
|
26
26
|
Token.Git.CommitMessage: 'git-cm',
|
|
27
27
|
Token.Git.CommitAuthor: 'git-ca',
|
|
28
28
|
Token.Git.Hint: 'git-hint',
|
|
29
|
+
Token.Git.Warning: 'git-warning',
|
|
30
|
+
Token.Git.Error: 'git-error',
|
|
31
|
+
Token.Git.Fatal: 'git-fatal',
|
|
29
32
|
Token.Git.Refs: 'git-r',
|
|
30
33
|
Token.Git.Untracked: 'git-untr',
|
|
31
34
|
Token.Git.Modified: 'git-mod',
|
|
@@ -49,7 +52,10 @@ class GitLexer(RegexLexer):
|
|
|
49
52
|
tokens = {
|
|
50
53
|
'root': [
|
|
51
54
|
(r'\n', Whitespace),
|
|
55
|
+
(r'^error:(.*?)\n', Token.Git.Error),
|
|
56
|
+
(r'^fatal:(.*?)\n', Token.Git.Fatal),
|
|
52
57
|
(r'^hint:(.*?)\n', Token.Git.Hint),
|
|
58
|
+
(r'^warning:(.*?)\n', Token.Git.Warning),
|
|
53
59
|
(r'^.*$\n', Generic.Output),
|
|
54
60
|
(r'[^\n]+', Generic.Output),
|
|
55
61
|
]
|
|
@@ -33,7 +33,7 @@ def test_git_command_with_hint():
|
|
|
33
33
|
(Token.Text, "desc"),
|
|
34
34
|
(Token.Text.Whitespace, "\n"),
|
|
35
35
|
# Output
|
|
36
|
-
(Token.
|
|
36
|
+
(Token.Git.Error, "error: the branch 'desc' is not fully merged.\n"),
|
|
37
37
|
(Token.Git.Hint, "hint: If you are sure you want to delete it, run 'git branch -D desc'.\n"),
|
|
38
38
|
(Token.Git.Hint, "hint: Disable this message with \"git config advice.forceDeleteBranch false\".\n"),
|
|
39
39
|
]
|
|
@@ -71,3 +71,87 @@ def test_git_command_with_empty_hint():
|
|
|
71
71
|
(Token.Git.Hint, "hint:\n"),
|
|
72
72
|
(Token.Git.Hint, "hint: git config --global init.defaultBranch <name>\n"),
|
|
73
73
|
]
|
|
74
|
+
|
|
75
|
+
def test_git_command_with_warning():
|
|
76
|
+
lexer = ShellConsoleLexer()
|
|
77
|
+
text = (
|
|
78
|
+
"user@host:~/directory $ git push origin main\n"
|
|
79
|
+
"warning: redirecting to url\n"
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
tokens = list(lexer.get_tokens(text))
|
|
83
|
+
assert tokens == [
|
|
84
|
+
# Prompt
|
|
85
|
+
(Token.Generic.Prompt.UserHost, "user@host"),
|
|
86
|
+
(Token.Generic.Prompt, ":"),
|
|
87
|
+
(Token.Generic.Prompt.Directory, "~/directory"),
|
|
88
|
+
(Token.Text.Whitespace, " "),
|
|
89
|
+
(Token.Generic.Prompt, "$"),
|
|
90
|
+
(Token.Text.Whitespace, " "),
|
|
91
|
+
(Token.Text, "git"),
|
|
92
|
+
(Token.Text.Whitespace, " "),
|
|
93
|
+
(Token.Text, "push"),
|
|
94
|
+
(Token.Text.Whitespace, " "),
|
|
95
|
+
(Token.Text, "origin"),
|
|
96
|
+
(Token.Text.Whitespace, " "),
|
|
97
|
+
(Token.Text, "main"),
|
|
98
|
+
(Token.Text.Whitespace, "\n"),
|
|
99
|
+
# Output
|
|
100
|
+
(Token.Git.Warning, "warning: redirecting to url\n"),
|
|
101
|
+
]
|
|
102
|
+
|
|
103
|
+
def test_git_command_with_error():
|
|
104
|
+
lexer = ShellConsoleLexer()
|
|
105
|
+
text = (
|
|
106
|
+
"user@host:~/directory $ git push origin main\n"
|
|
107
|
+
"error: src refspec main does not match any.\n"
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
tokens = list(lexer.get_tokens(text))
|
|
111
|
+
assert tokens == [
|
|
112
|
+
# Prompt
|
|
113
|
+
(Token.Generic.Prompt.UserHost, "user@host"),
|
|
114
|
+
(Token.Generic.Prompt, ":"),
|
|
115
|
+
(Token.Generic.Prompt.Directory, "~/directory"),
|
|
116
|
+
(Token.Text.Whitespace, " "),
|
|
117
|
+
(Token.Generic.Prompt, "$"),
|
|
118
|
+
(Token.Text.Whitespace, " "),
|
|
119
|
+
(Token.Text, "git"),
|
|
120
|
+
(Token.Text.Whitespace, " "),
|
|
121
|
+
(Token.Text, "push"),
|
|
122
|
+
(Token.Text.Whitespace, " "),
|
|
123
|
+
(Token.Text, "origin"),
|
|
124
|
+
(Token.Text.Whitespace, " "),
|
|
125
|
+
(Token.Text, "main"),
|
|
126
|
+
(Token.Text.Whitespace, "\n"),
|
|
127
|
+
# Output
|
|
128
|
+
(Token.Git.Error, "error: src refspec main does not match any.\n"),
|
|
129
|
+
]
|
|
130
|
+
|
|
131
|
+
def test_git_command_with_fatal():
|
|
132
|
+
lexer = ShellConsoleLexer()
|
|
133
|
+
text = (
|
|
134
|
+
"user@host:~/directory $ git push origin main\n"
|
|
135
|
+
"fatal: src refspec main does not match any.\n"
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
tokens = list(lexer.get_tokens(text))
|
|
139
|
+
assert tokens == [
|
|
140
|
+
# Prompt
|
|
141
|
+
(Token.Generic.Prompt.UserHost, "user@host"),
|
|
142
|
+
(Token.Generic.Prompt, ":"),
|
|
143
|
+
(Token.Generic.Prompt.Directory, "~/directory"),
|
|
144
|
+
(Token.Text.Whitespace, " "),
|
|
145
|
+
(Token.Generic.Prompt, "$"),
|
|
146
|
+
(Token.Text.Whitespace, " "),
|
|
147
|
+
(Token.Text, "git"),
|
|
148
|
+
(Token.Text.Whitespace, " "),
|
|
149
|
+
(Token.Text, "push"),
|
|
150
|
+
(Token.Text.Whitespace, " "),
|
|
151
|
+
(Token.Text, "origin"),
|
|
152
|
+
(Token.Text.Whitespace, " "),
|
|
153
|
+
(Token.Text, "main"),
|
|
154
|
+
(Token.Text.Whitespace, "\n"),
|
|
155
|
+
# Output
|
|
156
|
+
(Token.Git.Fatal, "fatal: src refspec main does not match any.\n"),
|
|
157
|
+
]
|
{pygments_shell_console-0.4 → pygments_shell_console-0.5.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
|