onefetch

repository·main·Indexed 11 days ago

https://github.com/o2sh/onefetch

A high-performance, offline command-line Git information tool that provides code statistics and project metadata directly in the terminal. It supports custom ASCII art and image rendering via Sixel, Kitty, and Iterm protocols, and allows for extensive customization of output fields, language filtering, and text formatting.

Tokens
13.4K
Snippets
63
Records
86
Agent score
95%

What's inside onefetch

  1. What is onefetch-ascii?

    main
    The onefetch-ascii crate provides the primary interface for displaying ASCII art within the terminal. It is a specialized component designed to work as part of the larger onefetch ecosystem to enhance the visual output of Git information in the command line.
  2. Use onefetch-manifest to detect and parse repository manifests

    main
    The onefetch-manifest crate serves as the primary interface for detecting and parsing a repository's manifest files. It is a core component of the onefetch ecosystem designed to identify project metadata and configuration files within a Git repository.
  3. What is onefetch-image and what protocols does it support?

    main

    The onefetch-image crate provides the primary interface for displaying images within a terminal. It is a specialized component designed to work as part of the onefetch ecosystem. It supports the following terminal image protocols:

    • Sixel
    • Kitty
    • Iterm
  4. Supported terminal image protocols

    main

    Onefetch supports three primary image protocols for rendering graphics:

    • Sixel: Supported by iterm2, xterm (with -ti 340), mlterm, and WezTerm.
    • Kitty: Uses the kitty graphics protocol, allowing programs to render graphics directly to the terminal screen.
    • ITerm: Uses the iTerm inline image protocol, supported by iTerm2 and WezTerm.
  5. Understand the ASCII art color token format

    main

    Onefetch ASCII art files use numeric tokens in the format {n} to define color segments.

    • {0} to {X} (where X > 0) are used to apply specific colors to the text.
    • The actual colors applied are determined by the order defined in the color palette or by the user via the --ascii-colors flag.

    Example of the token structure in an ASCII file:

    {2}            .:--::////::--.`
    {1}        `/yNMMNho{2}////////////:.
    {2}            .:--::////::--.`
    {1}        `/yNMMNho{2}////////////:.
    {1}      `+NMMMMMMMMmy{2}/////////////:`
    {0}    `-:::{1}ohNMMMMMMMNy{2}/////////////:`
  6. Install Onefetch on Windows

    main

    Onefetch is available on Windows via several package managers:

    • Winget: Standard Windows package manager.
    • Scoop: Available in the extras bucket.
    • Chocolatey: Standard Windows package manager.
    # Winget
    winget install onefetch
    
    # Scoop
    scoop bucket add extras
    scoop install onefetch
    
    # Chocolatey
    choco install onefetch
  7. Build Onefetch from source

    main

    To build Onefetch from source, you must first install the Rust toolchain using rustup and ensure that CMake is installed on your system. Once dependencies are met, clone the repository and use make install to build and install.

    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
    
    git clone https://github.com/o2sh/onefetch
    cd onefetch
    make install
  8. Set up Onefetch Web for development

    main

    To start developing Onefetch Web locally, you need to install the project dependencies and run the development server with hot reloading enabled.

    1. Install dependencies: Run npm i to install all required packages.
    2. Run the server: Run npm start to launch the development server with hot reloading active.
    # setup
    ## install dependencies
    npm i
    
    # run server with hot reloading
    npm start
  9. Install Onefetch using Cargo

    main

    You can use cargo to build and install the binary from source. This requires the Rust toolchain (installed via rustup) and CMake. To update an existing installation, use the --force flag.

    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
    
    cargo install onefetch
    
    # To update
    cargo install onefetch --force
  10. Basic Usage of Onefetch

    main

    You can run onefetch by providing a specific path to a repository or by navigating into the repository directory first.

    To run on a specific path:

    onefetch /path/of/your/repo

    To run in the current directory:

    cd /path/of/your/repo
    onefetch
    onefetch /path/of/your/repo
  11. Automate Onefetch on directory change (CMD)

    main

    For Windows cmd.exe, you can include this snippet in your AutoRun scripts or DOSKEY macrofiles to trigger onefetch when changing directories within a Git repository.

    @set LAST_REPOSITORY=
    
    @doskey cd = ( ^
        for %%^^^^ in ("") do @for /f "delims=" %%i in (^^""$*%%~^^"") do @( ^
            if "%%~i"="" ( ^
                if defined USERPROFILE ( ^
                    if /i not "%%CD%%"=="%%USERPROFILE%%" ( ^
                        chdir /d "%%USERPROFILE%%" ^&^& set "OLDPWD=%%CD%%" ^
                    ) ^
                ) else (call) ^
            ) else if "%%~i"=="-" ( ^
                if defined OLDPWD ( ^
                    if /i not "%%CD%%"=="%%OLDPWD%%" ( ^
                        chdir /d "%%OLDPWD%%"      ^&^& set "OLDPWD=%%CD%%" ^
                    ) ^
                ) else (call) ^
            ) else ( ^
                if defined CD ( ^
                    if /i not "%%CD%%"=="%%~fi" ( ^
                        chdir /d %%~fi             ^&^& set "OLDPWD=%%CD%%" ^
                    ) ^
                ) else (call) ^
            ) ^
        ) ^
    ) ^&^& for /f "delims=" %%r in ('git rev-parse --show-toplevel 2^^^>nul') do @( ^
        if not "%%~r"=="%%LAST_REPOSITORY%%" ( ^
            onefetch ^
        ) ^& set "LAST_REPOSITORY=%%~r" ^
    )