Giter Club home page Giter Club logo

age's Introduction

AG Enhanced (age)

AG Enhanced (age) is an extension of ag (The Silver Searcher), adding support for searching within various compressed file formats and automatically compressing older log files. This project maintains the same usage patterns as ag, ensuring seamless integration for existing users with additional functionality.

Features

  • Search within Compressed Files: Enables searching within zip, gz, tgz, and zstd compressed files directly.
  • Automatic Log File Compression: Automates the compression of .log files older than 7 days into .log.zstd to efficiently manage disk space.
  • Familiar ag Interface: Utilizes the same command-line interface as ag, allowing users to integrate with no additional learning curve.

Installation

Prerequisites

Ensure that ag (The Silver Searcher) is installed on your system. For installation instructions, please refer to its GitHub page.

Installing AG Enhanced

Download the latest release from the releases page and extract the binary to a directory in your PATH.

or

Install age directly from the source using Go:

go install github.com/auxten/age@latest

This command fetches the latest version of age from the GitHub repository and installs it.

Usage

Use age exactly like ag. Here are some example commands to get started:

Please make sure that the Go binary directory is in your PATH. or you can use the following command:

export PATH=$PATH:$(go env GOPATH)/bin
# Perform a basic search
age "search pattern" /path/to/search

# Use additional `ag` options
age -i "search pattern" /path/to/search

# Search within compressed files
age "pattern" /path/with/compressed/files

With iterm2

It's highly recommended to use iterm2 with age. iterm2 has a feature called "Semantic History" which allows you to search through the output of the terminal. This feature is very useful when you are searching for a specific command you ran in the past. But if you close the terminal, the history is gone. You can let iterm2 save all the output of the terminal to a directory. This way you can search through the output of the terminal even after you close the terminal.

But the output of the terminal can be very large and take up a lot of disk space. age can help you with that. age can compress the log files automatically after a certain amount of time.

To activate the session logs, go to iTerm2 Preferences (โŒ˜,), select the "Profiles" tab, then the "Session" tab. Under "Miscellaneous" you can specify a folder where log files for your sessions shall be saved in the future.

iterm2

See: https://stackoverflow.com/a/35798807/896026

You can also make a shell function to search your iterm2 session logs:

agl() {
    age "$@" ~/Documents/itermLog # change the path to your iterm2 log directory
}

Automatic Log File Compression

This functionality runs automatically. Any .log file older than 7 days is compressed to .log.zstd, and the original file is deleted.

Supported File Formats

  • .zip: Searches are conducted on each file within the zip archive.
  • .gz: Gzipped files are decompressed on-the-fly and searched.
  • .zstd: Files compressed with Zstandard are decompressed for searching.

Contributing

Contributions are highly appreciated.

License

This project is licensed under the Apache-2.0 license. See the LICENSE file for more details.

age's People

Contributors

auxten avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

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.