Giter VIP home page Giter VIP logo

g's Introduction

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

man.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 [email protected]: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`

Recommended terminal

macOS:

Windows:

cross-platform:

Shell Integration

completion

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

zsh

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

bash

wget https://raw.githubusercontent.com/Equationzhao/g/master/completions/bash/g-completion.bash

add the following lines to your ~/.bashrc file:

source /path/to/g-completion.bash

fish

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

Install the file to your fish completion directory, usually ~/.config/fish/completions

mv g.fish ~/.config/fish/completions

Restart your terminal session or run the following command to immediately enable the completion functionality:

source ~/.config/fish/config.fish

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

CONTRIBUTING

Interested in contributing? Check out the contributing guidelines.

Alternatives

g is highly inspired by following projects that you may 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 ...
performance better slower

Star History

Star History Chart

g's People

Contributors

dependabot[bot] avatar equationzhao avatar imouto-rar avatar kianmeng avatar vanillajonathan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

g's Issues

[FEAT] add quote when the name contains spaces

feature

when there are some entries named with tailing space, the g will not display them with a noticeable difference

eg:
image

so it's great to have those with spaces surrounded by quotes.

like

'space a  '
'space a    '

and if '--no-quote' is set, do not display quotes.

[BUG] --statistic only works with --total-size

Current Behavior

~/go as ⚡️
> g -statistic
bin  pkg
~/go as ⚡️
> g -statistic -total-size
  total -
  underwent 143 microseconds
  statistic file: 0, dir: 2, link: 0
bin  pkg

Expected Behavior

~/go as ⚡️
> g -statistic
bin  pkg
~/go as ⚡️
> g -statistic -total-size
  total -
  underwent 143 microseconds
  statistic file: 0, dir: 2, link: 0
bin  pkg

Environment

os:all
arch:all
version:v0.7.0

[STYLE] .python_history

Describe the Style you'd like to add
Color: python-color
Icon: python
Underline: false
Bold: false

Target: '.python_history'

Describe the file type
.python_history is the history file of py shell

[STYLE] .CFUserTextEncoding

Describe the Style you'd like to add
Color: Apple
Icon: Apple
Underline: false
Bold: false

Target: '.CFUserTextEncoding'

Describe the file type
.CFUserTextEncoding stores the default text encoding and preferred language for a user.

[FEAT] custom columns order

feature

the custom column order can bring more flexibility to daily use.

solution

the order can be defined in the config file or be passed by the command line option

eg:
through config

Args:
  - hyperlink=never
  - icons
  - no-update

Order:
  - Permissions 
  - Size     
  - Owner        
  - Group 
  - Time Modified   
  - Name

or g --order='Permissions,Size,Owner,Group,Time Modified,Name' --long

[BUG] panic when listing items

Describe the bug
panic when listing a dir

To Reproduce
unknown, no specific method for reproduction

Screenshots
image

Info (please complete the following information):

  • OS: [macOS 14.3]
  • Version [v0.25.2]

[BUG] panic when set --title and one of --table/csv/tsv/html

Describe the bug

Version: v0.25.3
Please file an issue at Github Repo with the following panic info

 × error message:
strings: negative Repeat count
 
 × stack trace:
goroutine 1 [running]:
runtime/debug.Stack()
        /opt/homebrew/opt/go/libexec/src/runtime/debug/stack.go:24 +0x64
main.main.func1()
        /Users/equationzhao/g/main.go:25 +0x200
panic({0x100767800?, 0x100860c00?})
        /opt/homebrew/opt/go/libexec/src/runtime/panic.go:914 +0x218
strings.Repeat({0x100705230?, 0x10060181c?}, 0x10060181c?)
        /opt/homebrew/opt/go/libexec/src/strings/strings.go:554 +0x2e0
github.com/Equationzhao/g/internal/cli.glob..func34.3.glob..func34.3.1.func2({0x10086b7e8?, 0x140001fb540}, {0x14000134000?, 0x100194d78?, 0x10?})
        /Users/equationzhao/g/internal/cli/g.go:989 +0x328
github.com/Equationzhao/g/internal/display.fire(...)
        /Users/equationzhao/g/internal/display/printer.go:55
github.com/Equationzhao/g/internal/display.(*TablePrinter).PrintBase(0x140001fb540, 0x1400059b420, {0x14000134000, 0x15, 0x20})
        /Users/equationzhao/g/internal/display/printer.go:544 +0x214
github.com/Equationzhao/g/internal/display.(*TSVPrinter).Print(0x100d895b0?, {0x14000134000?, 0x10060181c?, 0x4?})
        /Users/equationzhao/g/internal/display/printer.go:658 +0x60
github.com/Equationzhao/g/internal/cli.glob..func34(0x14000356480)
        /Users/equationzhao/g/internal/cli/g.go:1036 +0x2d2c
github.com/urfave/cli/v2.(*Command).Run(0x1400025c420, 0x14000356480, {0x14000338000, 0x7, 0x7})
        /Users/equationzhao/go/pkg/mod/github.com/urfave/cli/[email protected]/command.go:279 +0x754
github.com/urfave/cli/v2.(*App).RunContext(0x1400031e200, {0x100867d90?, 0x100d88d40}, {0x14000338000, 0x7, 0x7})
        /Users/equationzhao/go/pkg/mod/github.com/urfave/cli/[email protected]/app.go:337 +0x534
github.com/urfave/cli/v2.(*App).Run(0x10086b580?, {0x14000338000?, 0x3?, 0x3?})
        /Users/equationzhao/go/pkg/mod/github.com/urfave/cli/[email protected]/app.go:311 +0x3c
main.main()
        /Users/equationzhao/g/main.go:68 +0x29c

To Reproduce
g --table/csv/tsv/html --title

Info (please complete the following information):

  • OS: [macOS 14.0]
  • Version [v0.25.2]

[BUG] bad alignment in tree view

alignment in tree view
some flags which need to read file are not working in Tree view( refactor: using abs path may help)

eg:
bad alignment when encountering an error
image

when list in tree and display checksum, the file inside folder has no checksum field
image

Version:

At least since v0.5.7

[FEAT] WinGet support

Is your feature request related to a problem? Please describe.
The only package manager I have is winget. Can I have this package to be present on WinGet repository?

Describe the solution you'd like
winget install --id Equationzhao.G or something like this

Describe alternatives you've considered
Publishing to Microsoft Store but it requires payment for the developer account.

Additional context
WinGet repo is located in microsoft/winget-pkgs

[BUG] bad item name display

Describe the bug
may fail to display items whose name is contained in ANSI escape sequences

To Reproduce

  1. items listed
    listing items with names contained in ANSI escape sequences
    like '[', '3'
  2. flags set
    -Q or --icon or others

Screenshots

image image

Info:

  • OS: all
  • Arch: all
  • Version: at least since v0.16.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.