pygments-shell-console 0.2.1__tar.gz → 0.3__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.
Files changed (22) hide show
  1. {pygments_shell_console-0.2.1 → pygments_shell_console-0.3}/PKG-INFO +1 -1
  2. {pygments_shell_console-0.2.1 → pygments_shell_console-0.3}/git_lexer.py +11 -0
  3. {pygments_shell_console-0.2.1 → pygments_shell_console-0.3}/pyproject.toml +1 -1
  4. {pygments_shell_console-0.2.1 → pygments_shell_console-0.3}/test/test_git_status.py +48 -0
  5. {pygments_shell_console-0.2.1 → pygments_shell_console-0.3}/.github/workflows/publish-to-pypi.yml +0 -0
  6. {pygments_shell_console-0.2.1 → pygments_shell_console-0.3}/.gitignore +0 -0
  7. {pygments_shell_console-0.2.1 → pygments_shell_console-0.3}/README.md +0 -0
  8. {pygments_shell_console-0.2.1 → pygments_shell_console-0.3}/examples/git_lg.example +0 -0
  9. {pygments_shell_console-0.2.1 → pygments_shell_console-0.3}/examples/git_log.example +0 -0
  10. {pygments_shell_console-0.2.1 → pygments_shell_console-0.3}/examples/git_show.example +0 -0
  11. {pygments_shell_console-0.2.1 → pygments_shell_console-0.3}/examples/status.example +0 -0
  12. {pygments_shell_console-0.2.1 → pygments_shell_console-0.3}/examples/test.exmpl +0 -0
  13. {pygments_shell_console-0.2.1 → pygments_shell_console-0.3}/examples/test.sh +0 -0
  14. {pygments_shell_console-0.2.1 → pygments_shell_console-0.3}/shellconsole_lexer.py +0 -0
  15. {pygments_shell_console-0.2.1 → pygments_shell_console-0.3}/shellconsole_style.py +0 -0
  16. {pygments_shell_console-0.2.1 → pygments_shell_console-0.3}/test/__init__.py +0 -0
  17. {pygments_shell_console-0.2.1 → pygments_shell_console-0.3}/test/test_git.py +0 -0
  18. {pygments_shell_console-0.2.1 → pygments_shell_console-0.3}/test/test_git_branch.py +0 -0
  19. {pygments_shell_console-0.2.1 → pygments_shell_console-0.3}/test/test_git_log.py +0 -0
  20. {pygments_shell_console-0.2.1 → pygments_shell_console-0.3}/test/test_git_pretty_log.py +0 -0
  21. {pygments_shell_console-0.2.1 → pygments_shell_console-0.3}/test/test_git_show.py +0 -0
  22. {pygments_shell_console-0.2.1 → pygments_shell_console-0.3}/test/test_prompts.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pygments-shell-console
3
- Version: 0.2.1
3
+ Version: 0.3
4
4
  Requires-Dist: pygments
5
5
  Description-Content-Type: text/markdown
6
6
 
@@ -29,6 +29,7 @@ STANDARD_TYPES.update({
29
29
  Token.Git.Refs: 'git-r',
30
30
  Token.Git.Untracked: 'git-untr',
31
31
  Token.Git.Modified: 'git-mod',
32
+ Token.Git.Unmerged: 'git-unm',
32
33
  Token.Git.Staged: 'git-stg',
33
34
  Token.Git.Show: 'git-show',
34
35
  Token.Git.Show.Header: 'git-show-h',
@@ -129,6 +130,7 @@ class GitStatusLexer(RegexLexer):
129
130
  (r'\s*Untracked files:\n', Generic.Output, 'untracked'),
130
131
  (r'\s*Changes not staged for commit:\n', Generic.Output, 'modified'),
131
132
  (r'\s*Changes to be committed:\n', Generic.Output, 'staged'),
133
+ (r'\s*Unmerged paths:\n', Generic.Output, 'unmerged'),
132
134
  (r'^.*\n', using(GitLexer)),
133
135
  ],
134
136
  'untracked': [
@@ -158,6 +160,15 @@ class GitStatusLexer(RegexLexer):
158
160
  Whitespace
159
161
  )),
160
162
  ],
163
+ 'unmerged': [
164
+ (r'^\s*\n', Whitespace, '#pop'),
165
+ (r'^\s+\(.*\)\n', Generic.Output),
166
+ (r'^(\s*)([^\n]+)(\n)', bygroups(
167
+ Whitespace,
168
+ Token.Git.Unmerged,
169
+ Whitespace
170
+ )),
171
+ ],
161
172
  }
162
173
 
163
174
  class GitLogLexer(RegexLexer):
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "pygments-shell-console" # change this to a package name for your plugin
7
- version = "0.2.1"
7
+ version = "0.3"
8
8
  dependencies = ["pygments"]
9
9
  readme = "README.md"
10
10
 
@@ -202,3 +202,51 @@ def test_git_status_whit_hint():
202
202
  (Token.Git.Hint, "hint: You've added another git status command\n"),
203
203
  (Token.Generic.Output, "On branch main\n"),
204
204
  ]
205
+
206
+ def test_git_status_unmerged():
207
+ lexer = ShellConsoleLexer()
208
+ text = (
209
+ "user@host:~/directory (main) $ git status\n"
210
+ "On branch main\n"
211
+ "You have unmerged paths.\n"
212
+ " (fix conflicts and run \"git commit\")\n"
213
+ " (use \"git merge --abort\" to abort the merge)\n"
214
+ "\n"
215
+ "Unmerged paths:\n"
216
+ " (use \"git restore --staged <file>...\" to unstage)\n"
217
+ " (use \"git add <file>...\" to mark resolution)\n"
218
+ " both modified: README.md\n"
219
+ "\n"
220
+ "no changes added to commit (use \"git add\" and/or \"git commit -a\")\n"
221
+ )
222
+
223
+ tokens = list(lexer.get_tokens(text))
224
+
225
+ assert tokens == [
226
+ (Token.Generic.Prompt.UserHost, "user@host"),
227
+ (Token.Generic.Prompt, ":"),
228
+ (Token.Generic.Prompt.Directory, "~/directory"),
229
+ (Token.Text.Whitespace, " "),
230
+ (Token.Generic.Prompt.GitBranch, "(main)"),
231
+ (Token.Text.Whitespace, " "),
232
+ (Token.Generic.Prompt, "$"),
233
+ (Token.Text.Whitespace, " "),
234
+ (Token.Text, "git"),
235
+ (Token.Text.Whitespace, " "),
236
+ (Token.Text, "status"),
237
+ (Token.Text.Whitespace, "\n"),
238
+ # Output
239
+ (Token.Generic.Output, "On branch main\n"),
240
+ (Token.Generic.Output, "You have unmerged paths.\n"),
241
+ (Token.Generic.Output, " (fix conflicts and run \"git commit\")\n"),
242
+ (Token.Generic.Output, " (use \"git merge --abort\" to abort the merge)\n"),
243
+ (Token.Text.Whitespace, "\n"),
244
+ (Token.Generic.Output, "Unmerged paths:\n"),
245
+ (Token.Generic.Output, " (use \"git restore --staged <file>...\" to unstage)\n"),
246
+ (Token.Generic.Output, " (use \"git add <file>...\" to mark resolution)\n"),
247
+ (Token.Text.Whitespace, " "),
248
+ (Token.Git.Unmerged, "both modified: README.md"),
249
+ (Token.Text.Whitespace, "\n"),
250
+ (Token.Text.Whitespace, "\n"),
251
+ (Token.Generic.Output, "no changes added to commit (use \"git add\" and/or \"git commit -a\")\n"),
252
+ ]