Skip to content

Commit

Permalink
Merge pull request #35 from zlj-zz/dev
Browse files Browse the repository at this point in the history
Bump v1.6.0
  • Loading branch information
zlj-zz authored Aug 23, 2022
2 parents 321c7e5 + 10b9cc1 commit 783e5c6
Show file tree
Hide file tree
Showing 33 changed files with 51 additions and 2,746 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog of pigit

## v1.6.0 (2022-08-22)
- Show file icon in tui mode.
- Use new dependencies -- `plenty`(render).
- Independent render part, which is convenient for maintenance.

## v1.5.2 (2022-04-27)
- Fix parameter typing of Python3.8
- Fix `repo ll` command error, when has invalid repo path.
Expand Down
Binary file modified docs/classes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/packages.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion pigit/cmdparse/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
_SubParsersAction,
)
from shutil import get_terminal_size
from pigit.render.style import Style
from plenty.style import Style


if TYPE_CHECKING:
Expand Down
5 changes: 3 additions & 2 deletions pigit/codecounter.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
import concurrent.futures
from shutil import get_terminal_size

from plenty.table import Table
from plenty import get_console

from .common.utils import confirm, get_file_icon, adjudgment_type
from .render.table import Table
from .render import get_console


Logger = logging.getLogger(__name__)
Expand Down
3 changes: 2 additions & 1 deletion pigit/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
import os, re, textwrap, logging
from distutils.util import strtobool

from plenty.style import Color

from .common.utils import confirm, traceback_info
from .common.singleton import Singleton
from .render.style import Color

Logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion pigit/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import os, platform, datetime

__project__ = "pigit"
__version__ = "1.5.3-dev"
__version__ = "1.6.0"
__url__ = "https://github.com/zlj-zz/pigit.git"
__uri__ = __url__

Expand Down
3 changes: 2 additions & 1 deletion pigit/entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
from typing import Dict, List
import os, logging, textwrap

from plenty import get_console

from .log import setup_logging
from .config import Config
from .cmdparse.parser import command, argument, Namespace
Expand All @@ -18,7 +20,6 @@
COUNTER_DIR_PATH,
IS_FIRST_RUN,
)
from .render import get_console
from .common.utils import confirm
from .common.func import dynamic_default_attrs, time_it
from .gitlib.processor import ShortGitter, GIT_CMDS, get_extra_cmds
Expand Down
3 changes: 2 additions & 1 deletion pigit/gitlib/_cmd_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@

from typing import List, Tuple, Union

from plenty import echo

from ..common.utils import exec_cmd
from ..render import echo


def add(args: Union[List, Tuple]) -> None:
Expand Down
19 changes: 15 additions & 4 deletions pigit/gitlib/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,16 @@
from pathlib import Path
import os, re, textwrap, json

from pigit.common.utils import async_run_cmd, exec_async_tasks, exec_cmd
from pigit.render.str_utils import shorten, byte_str2str
from pigit.render.console import Console
from plenty.str_utils import shorten, byte_str2str
from plenty.console import Console

from pigit.common.utils import (
adjudgment_type,
async_run_cmd,
exec_async_tasks,
exec_cmd,
get_file_icon,
)
from pigit.gitlib.model import File, Commit, Branch


Expand Down Expand Up @@ -311,6 +318,7 @@ def load_status(
ident: int = 2,
plain: bool = False,
path: Optional[str] = None,
icon: bool = False,
) -> List[File]:
"""Get the file tree status of GIT for processing and encapsulation.
Args:
Expand Down Expand Up @@ -344,9 +352,12 @@ def load_status(
has_inline_merged_conflicts = change in ["UU", "AA"]

display_name = shorten(name, max_width - 3 - ident)

icon_str = get_file_icon(adjudgment_type(display_name)) if icon else ""

# color full command.
display_str = Console.render_str(
f"`{staged_change}`<{'bad' if has_no_staged_change else'right'}>`{unstaged_change}`<{'bad' if unstaged_change!=' ' else'right'}> {display_name}"
f"`{staged_change}`<{'bad' if has_no_staged_change else'right'}>`{unstaged_change}`<{'bad' if unstaged_change!=' ' else'right'}> {icon_str}{display_name}"
)

file_ = File(
Expand Down
5 changes: 3 additions & 2 deletions pigit/gitlib/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
from typing import Callable, Dict, List, Optional, Tuple, Union
import os, re, textwrap, random, logging

from plenty import get_console
from plenty.str_utils import shorten

from ..common.utils import exec_cmd, confirm, similar_command, traceback_info
from ..common.singleton import Singleton
from ..render import get_console
from ..render.str_utils import shorten
from .shortcmds import GIT_CMDS, CommandType

Log = logging.getLogger(__name__)
Expand Down
5 changes: 3 additions & 2 deletions pigit/info.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from typing import Dict, Literal, Optional, Tuple
import os, re

from plenty.table import UintTable
from plenty import box

from .const import __version__, __url__
from .gitlib.options import GitOption
from .render.table import UintTable
from .render import box


git = GitOption()
Expand Down
7 changes: 4 additions & 3 deletions pigit/interaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
import os, logging
from time import sleep

from plenty import get_console
from plenty.style import Style

from .const import IS_WIN
from .tui.event_loop import EventLoop, ExitEventLoop
from .tui.screen import Screen
from .tui.widgets import SwitchWidget, RowPanelWidget, CmdRunner, ConfirmWidget
from .render import get_console
from .render.style import Style
from .gitlib.options import GitOption

if TYPE_CHECKING:
Expand Down Expand Up @@ -69,7 +70,7 @@ class StatusPanel(RowPanelWidget):
repo_path, repo_conf = git.get_repo_info()

def get_raw_data(self) -> List["File"]:
return git.load_status(self.size[0])
return git.load_status(self.size[0], icon=True)

def process_raw_data(self, raw_data: List[Any]) -> List[str]:
return (
Expand Down
32 changes: 0 additions & 32 deletions pigit/render/__init__.py

This file was deleted.

43 changes: 0 additions & 43 deletions pigit/render/_loop.py

This file was deleted.

Loading

0 comments on commit 783e5c6

Please sign in to comment.