Git Product home page Git Product logo

lsd's Introduction

lsd

Listing descriptions of scripts. Eg

$ lsd /bin/z*
/bin/zcat                     ASCII/sh        l=2, c=#        Uncompress files to standard output.
/bin/zcmp                     ASCII/sh        l=2, c=#        Compare the uncompressed contents of compressed fi
/bin/zdiff                    ASCII/sh        l=2, c=#        sh is buggy on RS/6000 AIX 3.2. Replace above line
/bin/zegrep                   ASCII/sh        l=1, c=#                                     
/bin/zfgrep                   ASCII/sh        l=1, c=#                                     
/bin/zforce                   ASCII/sh        l=2, c=#        zforce: force a gz extension on all gzip files so 
/bin/zgrep                    ASCII/sh        l=3, c=#        zgrep -- a wrapper around a grep program that deco
/bin/zless                    ASCII/sh        l=5, c=#       This program is free software; you can redistribut
/bin/zmore                    ASCII/sh        l=6, c=#        This program is free software; you can redistribut
/bin/znew                     ASCII/sh        l=6, c=#        This program is free software; you can redistribut

Notice the false positives at the bottom? Those would be interesting to detect.

Contributing

  • PRs welcome! :)
  • There's a list of things I know need to be improved.

Installing it

sudo make install

lsd's People

Contributors

ksandom avatar

Watchers

 avatar James Cloos avatar  avatar

lsd's Issues

Detect licenses

Task

  • Find a way to detect licenses at the the beginning of files.
  • Return a description like "Rejected: license."

Background

Sometimes, people put the license of the program at the top of the script instead of the description. This is a case that we should be able to detect. Right now it's done by looking for a couple of key words. But this won't scale.

My current thinking is to

  • Build up an array of strings, which are the first line of licenses we've come across.
    • The first pass at solving this could be just two or more licenes (ie just enough to prove that the solution isn't a single hard coded string.)
    • This list will expand pretty quickly.
    • The list should be ordered in order of how frequently the licenses occur. Ie most common at the top. - Eg I'm guessing this will be a GPL of some form.
  • Test that the returned comment does not contain each license.
  • If it does, return a string like "Rejected: License." Ie it's not a comment.

Can the columns be improved?

Task

  • See if there is a better way to do the columns.

Background

When I introduced the colour codes, column no longer behaved in expected ways. So I ended up rolling my own, that is very slow (It is the bottleneck). It would be great to do this better. Preferably using tools that are part of a standard install.

Generate statistics of what has been found

Task

  • Output statistics at the bottom of the output about the material that has been discovered.

Background

I'd like to output a summary of what has been found. Eg

$ lsd /bin/z*
/bin/zcat                     ASCII/sh        l=2, c=#        Uncompress files to standard output.
/bin/zcmp                     ASCII/sh        l=2, c=#        Compare the uncompressed contents of compressed fi
/bin/zdiff                    ASCII/sh        l=2, c=#        sh is buggy on RS/6000 AIX 3.2. Replace above line
/bin/zegrep                   ASCII/sh        l=1, c=#                                     
/bin/zfgrep                   ASCII/sh        l=1, c=#                                     
/bin/zforce                   ASCII/sh        l=2, c=#        zforce: force a gz extension on all gzip files so 
/bin/zgrep                    ASCII/sh        l=3, c=#        zgrep -- a wrapper around a grep program that deco
/bin/zless                    ASCII/sh        l=5, c=#       This program is free software; you can redistribut
/bin/zmore                    ASCII/sh        l=6, c=#        This program is free software; you can redistribut
/bin/znew                     ASCII/sh        l=6, c=#        This program is free software; you can redistribut

ASCII/sh: 10
l=2, c=#: 4    l=1, c=#:2    l=3, c=#: 1    l=5, c=#: 1    l=6, c=#: 2

Run shellcheck over the code

Task

  • Run shell check over the code.
  • Address issues.

Background

This is only just exiting the proof-of-concept phase. Let's improve the code :)

Disable colour coding when in a pipe or redirect

Task

  • Automatically disable ANSI colour codes when in a pipe.

Background

Currently ANSI colour codes are always used. If someone wants to send the output to a file, this will cause unexpected results.

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.