Giter Site home page Giter Site logo

lsp's Introduction

lsp: list files in a mildly human-frendlier manner

Build Status

lsp lists files, like ls command, but it does not attempt to meet that archaic POSIX specification, so instead of this:

(bash)$ ls -l

total 16
-rw-r--r--  1 peterborzov  staff  1079  9 Aug 00:22 LICENSE
-rw-r--r--  1 peterborzov  staff    60  9 Aug 00:22 README.md

you get this: screenshot

Features

File Groups

Files grouped by type (with -l key or in modes when file type not shown). lsp distinguishes binary, text and executable files, symlinks and is aware of weird types like devices and unix socket thingy: lsp can show files grouped by type

Modification time in human-friendly format

-t key for when you are interested in modification time. It turns to the mode that makes most sense to me when I want to look up modtimes, sorted within file groups from recent to latest: Sometimes relative times are not very readible as well (like when you are interested in a specific date), use two flags -sl to show the full UTC timestamp in properties.

Size in human-friendly format

-s key, similarly to modtime key, shows file sizes and sorts within file groups from largest to smallest:

Async Timeout

The file information is collected asynchronously, BFS-like, with a separate thread for each file and a timeout threshold.

That means that the execution is not going to freeze because of some low-response device driver (like external hard drive or optical drive) or collecting info about a huge directory.

Align by left

I have been playing with aligning files and descriptions by center, and I like that you can see files with the same extension right away, but there are deifinitely cases when it gets weird. For now, there is -p key to render the file table in the left-aligned columns:

Todo before v1.0

  • Rewrite outline formatting: with the current design too much space is wasted, long filenames break things
  • Mark executable files as such
  • Think about how to represent file rights and ownership
  • Approach hidden and generated files as outlined in issue#3
  • Better test coverage
  • Expand in this README on philosophy of the project (tool in the unix way, minimize surprises, nothing's to be configurable)
  • Think of TODO list points

Github Issues and pull requests are very welcome, feel free to message me if you are considering contributing. See CONTRIBUTING.md for intro to the codebase

Installation

lsp is written in the go programming language. It can be installed using go get.

 $ go get github.com/dborzov/lsp

Then make sure that your $PATH includes the $GOPATH/bin directory. To do that, you can put this line your ~/.bash_profile or .zshrc:

export PATH=$PATH:$GOPATH/bin

Once it becomes more functional, lsp will be distributed in native binaries (without dependencies) for all platforms (Linux, MacOS, Windows).

Misc

MIT license.

lsp's People

Contributors

dborzov avatar langston-barrett 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lsp's Issues

No way to hide hidden files

ls hides hidden files by default, and has an ls -a option to show them. lsp seems to always display hidden files.

panic: runtime error: invalid memory address or nil pointer dereference

Hello, I've installed lsp using go get github.com/dborzov/lsp and when I tried to run lsp in any directory I've got error like this:

➜  empty  ls -a
.  ..
➜  empty  lsp
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x40 pc=0x403362]

goroutine 1 [running]:
runtime.panic(0x4fd180, 0x6502e8)
        /usr/lib/golang/src/pkg/runtime/panic.c:266 +0xb6
main.presentPath(0xc21004c640, 0x11, 0xc21004c820, 0x1b)
        /home/xaxes/.go/src/github.com/dborzov/lsp/paths.go:11 +0x32
main.renderSummary()
        /home/xaxes/.go/src/github.com/dborzov/lsp/render.go:20 +0x7b
main.render()
        /home/xaxes/.go/src/github.com/dborzov/lsp/render.go:15 +0x24
main.main()
        /home/xaxes/.go/src/github.com/dborzov/lsp/main.go:23 +0x245

goroutine 3 [sleep]:
time.Sleep(0xbebc200)
        /usr/lib/golang/src/pkg/runtime/time.goc:31 +0x31
main.func·002()
        /home/xaxes/.go/src/github.com/dborzov/lsp/utils.go:10 +0x26
created by main.setTimeoutTimer
        /home/xaxes/.go/src/github.com/dborzov/lsp/utils.go:12 +0x21

I'm using Fedora 20 and FS is XFS if it does matter

Installation problem

I got this error when installing
package github.com/dborzov/lsp: cannot download, $GOPATH not set. For more details see: go help gopath

Ellisons don't play nice with column alignment

For example all rows with the [...] substituted in have slightly incorrect offsets for the following columns, for example the "Digital Marketing Executive - Ar..." entry below.

dogecoin-logo.png                                                                             Binary File
Digital Marketing Executive - Ar[...]                                   Binary File
final.gif                                                                                     Binary File

Output is from a 55x186 gnome terminal session.

lsp -l cannot take an argument

Perhaps it's a feature, but I expected to be able to do a lsp -l /path/to/destination/. However,

$ mkdir -p /tmp/a/b
$ ls /tmp/a/
b
$ lsp -l /tmp/a/
Unable to list directory: open /home/kseistrup/ /tmp/a: no such file or directory
$ lsp -l/tmp/a/
[··· 193 lines deleted ···]
                                lsp "~", 181 files, 69 directories
$ 

WTF?

Create --help flag

LSP doesn't support either --help or --usage flags. This is a barrier to usability. Suggestion: for good command line flags using Go, I've used this package.

Usage information

Using lsp would be much easier with a "usage" option, which would print out an explanation of the various flags and what they do. Perhaps a --help or --usage flag?

Help option

Hi, thanks for the nice tool.

Is a lsp --help or something in the pipeline? Where all the possible command-line options are shown?

`lsp -pt` Is not consistent

For example lsp -pt will first print

---------------------------------------------------------------------------------------------------------------------

                                                   --Regular files--

                                                       --Blobs--
yabs.yaml                                                  5 days ago

                                                     --Text Files--
.clang-format                                              25 minutes ago
yabs.yml                                                   16 hours ago
Makefile                                                   5 days ago
README.md                                                  5 days ago
yabs.pro                                                   5 days ago
.coveralls.yml                                             5 days ago
LICENSE                                                    5 days ago
.gitignore                                                 5 days ago
.travis.yml                                                5 days ago
.yabs.yml                                                  5 days ago

                                                    --Empty Files--
yabs.ybf                                                   2 hours ago

                                                    --Directories--
include                                                    1 hour ago
src                                                        2 hours ago
test                                                       2 hours ago
---------------------------------------------------------------------------------------------------------------------
                 lsp "~/Repos/yabs", 16 files, 3 directories
                                git repo (remote at [email protected]:yabs)

Then print

---------------------------------------------------------------------------------------------------------------------

                                                    --Directories--
include                                                    1 hour ago
src                                                        2 hours ago
test                                                       2 hours ago

                                                   --Regular files--

                                                     --Text Files--
.clang-format                                              25 minutes ago
yabs.yml                                                   16 hours ago
Makefile                                                   5 days ago
README.md                                                  5 days ago
yabs.pro                                                   5 days ago
.coveralls.yml                                             5 days ago
LICENSE                                                    5 days ago
.gitignore                                                 5 days ago
.travis.yml                                                5 days ago
.yabs.yml                                                  5 days ago

                                                    --Empty Files--
yabs.ybf                                                   2 hours ago

                                                       --Blobs--
yabs.yaml                                                  5 days ago
---------------------------------------------------------------------------------------------------------------------
                 lsp "~/Repos/yabs", 16 files, 3 directories
                                git repo (remote at [email protected]:yabs)

When called again

Need to link file after install

Hi, following your instructions results in lsp being installed in your $GOPATH directory, but it doesn't actually link it

I had to

sudo ln /usr/local/go/bin/lsp /usr/bin/lsp

to use it as advertised.

Some text is invisible in my terminal

I seem to have some weird issue where some of my text is invisible when I run the lsp command. I'm using the solarized color scheme with zsh on arch linux.

Here is an example picture:
Example

AUR Package for lsp.

Can we have an aur package for lsp.

AUR -> Arch User Repostory.

I can help you in that, if you want.

list of files inaccurate

I'm seeing a weird behavior when running lsp. When I run lsp in pretty much any directory, the number of files is accurate but I'm seeing lots of repeated filenames. For example, in a given directory with 100 files, I see 100 files in the list but only one or two filenames, almost like a couple of the names "smear" over everything else.

Below is how to reproduce this problem. I'm running ubuntu 14.04 LTS x64 and I built lsp using go version xgcc (Ubuntu 4.9.1-0ubuntu1) 4.9.1 linux/amd64. I ran a simple 'go get ' like the README specifies.

Thanks for the awesome tool. Hopefully we can fix this. I'll take a look too but I have zero go programming experience. =)

To reproduce the problem:

  1. In some directory, create some files:
    for i in {1..20}; do touch file$i; done
  2. Run lsp and get this:

                                                  file9  Empty File (Empty File)
                                                  file9  Empty File (Empty File)
                                                  file9  Empty File (Empty File)
                                                  file9  Empty File (Empty File)
                                                  file9  Empty File (Empty File)
                                                  file9  Empty File (Empty File)
                                                  file9  Empty File (Empty File)
                                                  file9  Empty File (Empty File)
                                                  file9  Empty File (Empty File)
                                                  file9  Empty File (Empty File)
                                                  file9  Empty File (Empty File)
                                                  file9  Empty File (Empty File)
                                                  file9  Empty File (Empty File)
                                                  file9  Empty File (Empty File)
                                                  file9  Empty File (Empty File)
                                                  file9  Empty File (Empty File)
                                                  file9  Empty File (Empty File)
                                                  file9  Empty File (Empty File)
                                                  file9  Empty File (Empty File)
                                                  file9  Empty File (Empty File)

               lsp "/tmp/problem", 20 files, 0 directories

Don't print headings for empty sections

For example, in the LSP repo, using lsp -l results in

lsp ➤ lsp -l
-------------------------------------------------------------------------------

                                --Regular files--

                                  --Text Files--
                           .travis.yml  
                            .gitignore  
                          arguments.go  
                     arguments_test.go  
                       CONTRIBUTING.md  
                                fmt.go  
                           fileinfo.go  
                           filelist.go  
                        investigate.go  
                               LICENSE  
                               main.go  
                              paths.go  
                             README.md  
                               sort.go  
                            tty_win.go  
                           traverse.go  
                               trie.go  
                           tty_unix.go  
                              utils.go  
-------------------------------------------------------------------------------
lsp "~/Dropbox/workspace/pulls/lsp", 20 files, 0 directories
 git repo (remote at https://github.com/siddharthist/lsp.git)

Where there are no 'regular files'. Therefore, there is no reason to print 'regular files'. Strangely, this behavior doesn't apply to the executable files heading.

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.