Skip to content

Commit

Permalink
link operations
Browse files Browse the repository at this point in the history
  • Loading branch information
Spitfire1900 committed Mar 28, 2024
1 parent e5d493a commit 3ba1818
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 3 additions & 2 deletions xontrib/pygitstatus/entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

from .prompts import (ahead, behind, branch, changed, clean, conflicts, curr_branch,
deleted, gitstatus, lines_added, lines_deleted, numstat,
repo_path, short_head, staged, stash_count, tag, tag_or_hash,
untracked)
operations, repo_path, short_head, staged, stash_count, tag,
tag_or_hash, untracked)


def _load_xontrib_(xsh: XonshSession, **_) -> dict:
Expand Down Expand Up @@ -41,6 +41,7 @@ def _load_xontrib_(xsh: XonshSession, **_) -> dict:
prompt_fields['pygitstatus.lines_added'] = lines_added
prompt_fields['pygitstatus.lines_deleted'] = lines_deleted
prompt_fields['pygitstatus.numstat'] = numstat
prompt_fields['pygitstatus.operations'] = operations
prompt_fields['pygitstatus.repo_path'] = repo_path
prompt_fields['pygitstatus.short_head'] = short_head
prompt_fields['pygitstatus.staged'] = staged
Expand Down
6 changes: 5 additions & 1 deletion xontrib/pygitstatus/prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
GIT_STATUS_WT_MODIFIED, GIT_STATUS_WT_NEW, Commit, Diff, GitError)
from pygit2 import Repository as Repo
from xonsh.prompt.base import MultiPromptField, PromptField, PromptFields
from xonsh.prompt.gitstatus import operations as gitstatus_operations

### .venv/Lib/site-packages/xonsh/prompt/gitstatus.py

Expand Down Expand Up @@ -149,6 +150,9 @@ def numstat(fld: PromptField, ctx: PromptFields):
fld.value = str((insert, delete))


operations = gitstatus_operations


@PromptField.wrap(name='pygitstatus.repo_path')
def repo_path(fld: PromptField, ctx: PromptFields):
fld.value = ''
Expand Down Expand Up @@ -238,7 +242,7 @@ class GitStatus(MultiPromptField):
".branch",
".ahead",
".behind",
"gitstatus.operations", # does not use subprocess calls
".operations",
"{RESET}|",
".staged",
".conflicts",
Expand Down

0 comments on commit 3ba1818

Please sign in to comment.