Giter Club home page Giter Club logo

list-and-grep's Introduction

list-and-grep

I often found myself searching for files in my current directory, and while find . -iname "*file*" is great for recursive searching, and ls | grep [PATTERN] works, I kept having to chain shell commands together to get the exact behavior I wanted. Rather than creating a bunch of aliases, I decided to make life easier and just create a script that handled the options for me.

Installation

From your terminal, clone the repository where you want it.

git clone https://github.com/evanthegrayt/list-and-grep.git

If you have rake installed (gem install rake), from inside the base repository directory, run:

rake

This will link the executable in your path (/usr/local/bin). If you aren't using rake, you can link the executable yourself. From inside the base repository directory, run:

ln -s $PWD/bin/lsg /usr/local/bin/lsg

Usage

Just pass the search pattern as an argument.

lsg [PATTERN]

To see a list of behavior-modifying options, run lsg -h, or for the manual, run lsg --man.

Configuration

You can create a file called ~/.lsgrc to configure the way the script behaves. Currently, the only configurations are for the output color. Just be forewarned, enabling color could considerably increase run-time when the directory contains a very large amount of entries.

use_color: true        # Use colored output? (default: false)
color:     "\e[1;92m"  # The color used when showing matches (default: green)

Note that you are able to enable/disable colored output at runtime with the --[no-]color option, which will override the boolean in the configuration file.

Self-Promotion

I do these projects for fun, and I enjoy knowing that they're helpful to people. Consider starring the repository if you like it! If you love it, follow me on github!

list-and-grep's People

Contributors

evanthegrayt avatar

Stargazers

 avatar  avatar

Watchers

 avatar

list-and-grep's Issues

Make into a gem

Do the things to make this a gem, and host on rubygems.org

Fix color capitalization

When a match is found via a case-insensitive match, color is not added if the cases don't match.

For example, if two files exist ["Documents", "directory"]:

$ lsg  d
Documents # First letter "D" is not colored because it's capital.
directory # First letter "d" is colored as expected

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.