g

command module
v0.25.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 15, 2024 License: MIT Imports: 11 Imported by: 0

README

g

一个强大的 ls 工具

View this document in English

g 是一个 ls 替代品,拥有下面一些功能:

  1. 显示带有类型特定图标和颜色的条目,并且易于更改
  2. 有丰富的输出格式 ( grid/across/byline/zero/comma/table/html/json/markdown/tree )
  3. 用户友好的选项
  4. 支持显示 git status
  5. 丰富且可自定义的排序选项
  6. 跨平台 ( Linux/Windows/MacOS )
  7. 支持使用fzf 算法,像 zoxide 一样模糊匹配路径

截图

image

安装

源码安装

要求 go version >= 1.21

go install -ldflags="-s -w"  github.com/Equationzhao/g@latest

或者 clone 这个仓库 (nightly build)

git clone github.com/Equationzhao/g
cd g
go build -ldflags="-s -w" # use -s -w to shrink size
# then add the executable file to your `PATH`
通过包管理器

archlinux 用户可以通过 AUR 安装 g

yay -S g-ls

homebrew:

brew tap equationzhao/core git@github.com:Equationzhao/homebrew-g.git
brew install g-ls

windows scoop:

scoop install https://raw.githubusercontent.com/Equationzhao/g/master/scoop/g.json
# upgrade
scoop uninstall g # uninstall first
scoop install https://raw.githubusercontent.com/Equationzhao/g/master/scoop/g.json
# error msg like this can be ignored
# Move-Item: 
# Line |
#    2 |  mv g-amd64.exe g.exe
#      |  ~~~~~~~~~~~~~~~~~~~~
# Move-Item: 
# Line |
#    3 |  mv g-amd64.shim g.shim
#      |  ~~~~~~~~~~~~~~~~~~~~~~
二进制文件
deb

release 页下载对应deb文件后安装

sudo dpkg -i g_$version_$arch.deb
tar.gz/zip

release page 下载对应平台的文件, 解压 gzip 并将可执行文件添加到 PATH

推荐使用的终端

macOS:

Windows:

cross-platform:

用法

g path(s)

Shell 脚本

生成 shell 脚本

g -init bash/zsh/fish/pwsh
bash
# add the following command to .bashrc
eval "$(g --init bash)"
# then `source ~/.bashrc`
zsh
# add the following command to .zshrc
eval "$(g --init zsh)"
# then `source ~/.zshrc`
fish
#  add to fish config:
g --init fish | source
#  then `source ~/.config/fish/config.fish`
powershell
# add the following line to your profile
Invoke-Expression (& { (g --init powershell | Out-String) })

使用 echo $profile命令查找配置文件路径

nushell
# add the following to your $nu.env-path
^g --init nushell | save -f ~/.g.nu
# then add the following to your $nu.config-path
source ~/.g.nu

# if you want to replace nushell's g command with g
# add the following definition and alias to your $nu.config-path
#
# def nug [arg?] {
#     if ($arg == null) {
#         g $arg
#     } else {
#         g
#     }
# }
# alias g = ^g

更多选项

g.md 或查看 主页

自定义主题

theme

TODO

  • Version sort
  • Git sort
  • Print security context
  • $OLDPWD
  • Color Support for html/markdown
  • Support Scoop

以下是 eza 的新功能,后续计划支持

  • --git-repos: list each directory’s Git status, if tracked
  • --git-repos-no-status: list whether a directory is a Git repository, but not its status (faster)

CONTRIBUTING

查看 CONTRIBUTING

其他选择

本项目受到以下项目的启发,你也许想试试

Star History

Star History Chart

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL