g

command module
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: MIT Imports: 11 Imported by: 0

README

g


A feature-rich, customizable, and cross-platform ls alternative.

Experience enhanced visuals with type-specific icons, various layout options, and git status integration.


Key Features

  1. Customizable Display: Icons and colors specific to file types, easy to customize.
  2. Multiple Layouts: Choose from grid, across, byline, zero, comma, table, json, markdown, and tree layouts.
  3. Git Integration: View file git-status/repo-status/repo-branch directly in your listings.
  4. Advanced Sorting: Highly customizable sorting options like version-sort.
  5. Cross-Platform Compatibility: Works seamlessly on Linux, Windows, and MacOS.
  6. Fuzzy Path Matching: zoxide and fzf like fuzzy path matching.
  7. Hyperlink support: Open files/directories with a single click.

Screenshots

image

Usage

g path(s)
g --icon --long path(s) # show icons and long format
g --tree --long path(s) # show tree layout

More options

g.md

Installation Guide

Via package manager
Arch Linux (AUR)
yay -S g-ls
Homebrew
brew install g-ls

or use the homebrew tap:

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

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
Winget

TODO, see issue

Pre-built executable
install script
install
bash -c "$(curl -fsSLk https://raw.githubusercontent.com/Equationzhao/g/master/script/install.sh)"
uninstall
curl -fsSLk https://raw.githubusercontent.com/Equationzhao/g/master/script/install.sh | bash /dev/stdin -r     
deb

download from release page

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

just download from release page, extract the gzip and add the executable file to your PATH

From source

Requires Go version >= 1.21

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

Alternatively, clone the repo for a dev version:

git clone github.com/Equationzhao/g
cd g
go build -ldflags="-s -w" 
# then add the executable file to your `PATH`

macOS:

Windows:

cross-platform:

Shell Integration

completion

only zsh completion is supported now

if you install g through brew or the install script, the completion is usually installed already.

wget https://raw.githubusercontent.com/Equationzhao/g/master/completions/zsh/_g

install the file to your zsh completion directory, usually /usr/local/share/zsh/site-functions or /usr/share/zsh/site-functions (or anywhere in your $FPATH)

mv _g ~/.zsh/completions

make sure autoload -Uz compinit and compinit are in the ~/.zshrc or ~/.zprofile

if not, add them to at least one of them.

autoload -Uz compinit
compinit
alias

Generate initialization scripts(alias) for various shells:

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) })

use command echo $profile to find your profile path

nushell

the nushell has a nice built-in ls command, but if you wanna try g in nushell, you can do the following:

ps: the script is not guaranteed to work, if you have any problem, please file an issue

# 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

Custom theme

theme

TODO

  • Version sort
  • Git sort
  • Print security context
  • $OLDPWD
  • Support Scoop

The following are new features of eza, we may support them in the future

  • --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

Interested in contributing? Check out the contributing guidelines.

Alternatives

g is highly inspired by following projects that you wanna try!

eza g
display mode oneline,grid,across,tree,recurse oneline,grid,across,zero,comma,table,json,markdown,tree,recurse
unique feature -Z: list each file’s security context,-@: list each file’s extended attributes and sizes ... --mime: list each file's mime type, --charset: list each file's charset, --relative-to: list relative path ...
performance better slower

Star History

Star History Chart

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal
cli
const
Package constval contains the constants used in the project this package can't depend on other packages
Package constval contains the constants used in the project this package can't depend on other packages
const/doc
Package doc is used to generate docs when `-tags doc` is passed to go build Enable = true, and the corresponding logic in the main.go will be executed g.md and man will be generated by default, Enable = false
Package doc is used to generate docs when `-tags doc` is passed to go build Enable = true, and the corresponding logic in the main.go will be executed g.md and man will be generated by default, Enable = false
display
Package display This package controls the display format, like grid/across/byline/...
Package display This package controls the display format, like grid/across/byline/...
git

Jump to

Keyboard shortcuts

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