Git的简单终端工具。
项目描述
皮吉特
git 的终端工具。当我们使用 git 的时候,你是不是对太长的命令感到很不舒服。例如:git status --short,这个项目可以帮助你改进它。这个项目是用 Python 编写的。现在大多数类 UNIX 系统都带有 Python。因此,您可以轻松安装和使用它。
用法
如果你想使用它,你必须首先知道它可以做什么。
pigit -h或pigit --help获取使用帮助信息的命令。像这样:
usage: pigit [-h] [-v] [-r] [-f] [-i] [-c [PATH]] [-C] [--create-ignore TYPE]
[--create-config]
{cmd,repo} ...
Pigit TUI is called automatically if no parameters are followed.
positional arguments:
{cmd,repo}
cmd git short command.
repo repo options.
open open remote repository in web browser.
optional arguments:
-h, --help show this help message and exit
-v, --version Show version and exit.
-r, --report Report the pigit desc and exit.
-f, --config Display the config of current git repository and exit.
-i, --information Show some information about the current git repository.
tools arguments:
Auxiliary type commands.
-c [PATH], --count [PATH]
Count the number of codes and output them in tabular form.A given path can be
accepted, and the default is the current directory.
-C, --complete Add shell prompt script and exit.(Supported bash, zsh, fish)
--create-ignore TYPE Create a demo .gitignore file. Need one argument, support: [android, c++, cpp, c,
dart, elisp, gitbook, go, java, kotlin, lua, maven, node, python, qt, r, ros, ruby,
rust, sass, swift, unity]
--create-config Create a pre-configured file of PIGIT.(If a profile exists, the values available in it
are used)
cmd
该命令cmd支持一些短的子命令来代替长的 git 原始命令。
用来查看pigit cmd -s它支持什么短命令,它会显示相应的帮助信息和git原始命令,像这样:
These are short commands that can replace git operations:
b lists, creates, renames, and deletes branches.
git branch
bc creates a new branch.
git checkout -b
bl lists branches and their commits.
git branch -vv
bL lists local and remote branches and their commits.
git branch --all -vv
bs lists branches and their commits with ancestry graphs.
git show-branch
bS lists local and remote branches and their commits with ancestry graphs.
git show-branch --all
bm renames a branch.
git branch --move
bM renames a branch even if the new branch name already exists.
git branch --move --force
bd delete a local branch by name.
git branch -d
......
repo
支持命令repo同时操作多个repos。
用于pigit repo -h获得更多帮助。
相互作用
即使您可以使用短命令代替 git 的长命令,但在某些情况下,简单的命令可能会非常糟糕。例如:git add a/b/1.txt b/c/1.txt c/d/1.txt。
因此,我们需要一个 TUI 来帮助我们,因此 Pigit 提供了一个简单的命令行交互式 TUI。当你pigit不跟随任何参数使用时,你将进入它。
并且在交互模式下,您可以使用?或h来查看帮助信息。
安装
点
pip install -U pigit
资源
git clone https://github.com/zlj-zz/pigit.git --depth=1
cd pigit
make install
# or
python setup.py install # On windows
别名
Alias 是帮助您更快地使用pigit的好方法。打开您的外壳配置文件并附加:
if type pigit >/dev/null 2>&1; then
alias gt="pigit"
alias g="pigit cmd"
alias repo="pigit repo"
fi
然后,您可以使用gtto callpigit和 use gto call pigit cmd。
配置
您可以使用pigit --create-config在pigit主路径创建模板配置。
在 Linux 或 MacOS 上:~/.config/pigit
在窗户上应该是:C:\\User\\<your username>
这是一个配置模板。
| 配置键 | 类型 | 默认 | 描述 |
|---|---|---|---|
| cmd_show_original | 布尔 | 真的 | 显示原始 git 命令。 |
| cmd_recommend | 布尔 | 真的 | 输入错误命令时是否建议更正。 |
| tui_help_showtime | 漂浮 | 1.5 | 以交互方式显示帮助信息的时间。 |
| counter_use_gitignore | 布尔 | 真的 | 是否使用.gitignore文件的忽略配置。 |
| counter_show_invalid | 布尔 | 错误的 | 是否显示无法统计的文件。 |
| counter_show_icon | 布尔 | 真的 | 是否显示文件图标。需要字体支持,例如:“Nerd Font”。 |
| 计数器格式 | 字符串 | 桌子 | 统计结果的输出格式。支持:[表格,简单] |
| git_config_format | 字符串 | 桌子 | Git 本地配置打印格式。支持:[表,正常] |
| repo_info_include | 列表 | [“远程”,“分支”,“日志”] | 控制查看 git 仓库信息时需要显示哪些部分。支持:(路径、远程、分支、日志、摘要) |
| repo_auto_append | 布尔 | 错误的 | 是否自动附加到 repos 的路径。 |
| 调试打开 | 布尔 | 错误的 | 是否在调试模式下运行 PIGIT。 |
| 日志输出 | 布尔 | 错误的 | 是否在终端输出日志。 |
额外的 cmd
您可以设置自定义 cmd。它需要在pigit home 中创建一个extra_cmds.py文件。像这样写:
import os
def print_user(args):
print(os.system('whoami'))
extra_cmds = {
'echo': {
'command': 'echo 123',
},
'print-user': {
'command': print_user,
'type': 'func',
'help': 'print system user name.'
}
}
extra_cmds字典是必须的。结构是命令键和命令信息。
命令信息有一些选项:
command:(必有)短命对应完整的命令或方法。如果它是一个方法,它必须接收一个参数元组。type: (Option) 标记命令类型,支持['func', 'command'],默认为'command'。help:(选项)命令帮助信息。has_arguments: (Option, bool) 命令是否接受参数。默认为真。
特征
- 用于快速使用 Git 的短命令,并自定义您的短命令。
- 当命令错误时提供命令更正。
- 有一个简单的tui交互,完成非常麻烦的操作。
- 代码统计并能精美展示。
- 支持生成和使用 shell 补全脚本。
- 支持从互联网创建
.gitignore模板。 - 支持在网站上快速打开远程 url。
- 支持管理多个仓库。
- 有日志输出和帮助信息提示。
执照:麻省理工学院
项目详情
下载文件
下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。