Giter Club home page Giter Club logo

colorls's Issues

Support for -R / --recursive

This flag option can be used to recursively print all files inside sub-directories.

Side note : The existing -r / --report flag can be changed to -i / --info.

Support -A / --almost-all

From man ls:
image

Expected behaviour

  1. colorls -A list all entries except . and ..
  2. colorls -a list all entries including . and ..

Current behaviour

  1. There's no -A nor --almost-all
  2. Option -a/--all is doing -A/--almost-all's jobs

List of issues that do not work like normal ls

There're some options that works on normal /usr/bin/ls but does not work or works differently in colorls. Here're some (there're more in man ls but I couldn't list them all, so I just list things I needed most):

  • Support files
  • -a and --all should also list . and ..
  • -A and --almost-all should list all files except . and ..
  • -l should print a long list
  • -lh and -l --human-readable should print a long list with human readable file size (in B, KB, MB, etc.)

Related:

Support -gs / --git-status flag

I wrote a short shellscript that works like ls -lrt but displays the git status next to each file displayed, as shown in the [..] here:

joey s xterm at 10 52 12 am on saturday 8 july 2017

You could consider adding a similar feature to lsc.

The git status of each file could be indicated either using an icon, or using color (on the icon, or on the file).

(There are other versioning systems than git, so it might be good to leave room for them in future.)

Font Icons & Linux

Hi. I'm trying to run this on Linux. I'm a little stuck at the install line that says "Install the patched fonts of powerline nerd-font and/or font-awesome." Can you give some better instructions?

Also, (at least on Linux) the lc command is already taken by the Mono Licnese Compiler if you have Mono installed. This may be an issue for some others.

error on empty folder ?

Hey there, first off awesome project.
I just installed it and it look really neat !

But I happend to use it against some empty directory and I got that

uncoolshogun@tpx1:~$ mkdir test
uncoolshogun@tpx1:~$ sl test/
/var/lib/gems/2.3.0/gems/colorls-0.1.4/lib/colorls/core.rb:103:in 'in_line': undefined method '+' for nil:NilClass (NoMethodError)
        from /var/lib/gems/2.3.0/gems/colorls-0.1.4/lib/colorls/core.rb:87:in 'chunkify'
        from /var/lib/gems/2.3.0/gems/colorls-0.1.4/lib/colorls/core.rb:20:in 'ls'
        from /var/lib/gems/2.3.0/gems/colorls-0.1.4/lib/colorls/flags.rb:23:in 'block in process'
        from /var/lib/gems/2.3.0/gems/colorls-0.1.4/lib/colorls/flags.rb:21:in 'each'
        from /var/lib/gems/2.3.0/gems/colorls-0.1.4/lib/colorls/flags.rb:21:in 'process'
        from /var/lib/gems/2.3.0/gems/colorls-0.1.4/exe/colorls:4:in '<top (required)>'
        from /usr/local/bin/colorls:23:in 'load'
        from /usr/local/bin/colorls:23:in '<main>'
uncoolshogun@tpx1:~$ 

I am not familiar with ruby but it does look like a stack trace 😝
Is it just me ? I am on ubuntu 16.04

ps : sl is my alias for colorls ^-^

Can't use in a Ruby project

Great project, definitely snazzes up a dull terminal. I was just about to alias ls to lc when i ran into trouble once i tried this inside of a Ruby (rails) project.

It looks like it needs the colorize gem in the bundle to work and I even threw it into the gemfile to see if that works, no luck.
Here is my error:

/Users/vincent/.rbenv/versions/2.2.6/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- colorize (LoadError)
	from /Users/vincent/.rbenv/versions/2.2.6/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
	from /Users/vincent/bin/colorls/colorls.rb:3:in `<main>'

Any idea how to fix?

Much appreciated!

bundle fails to install terminfo

When I run bundle install I get this error:

Fetching gem metadata from https://rubygems.org/................
Fetching version metadata from https://rubygems.org/..
Resolving dependencies...
Using rake 12.0.0
Using colorize 0.8.1
Using facets 3.1.0
Using parallel 1.11.2
Using ast 2.3.0
Using powerpack 0.1.1
Using ruby-progressbar 1.8.1
Using unicode-display_width 1.3.0
Fetching ruby-terminfo 0.1.1

Your user account isn't allowed to install to the system RubyGems.
  You can cancel this installation and run:

      bundle install --path vendor/bundle

  to install the gems into ./vendor/bundle/, or you can enter your password
  and install the bundled gems to RubyGems using sudo.

  Password: 
Installing ruby-terminfo 0.1.1 with native extensions
Using bundler 1.15.1
Using rainbow 2.2.2
Using parser 2.4.0.0
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /tmp/bundler20170703-28554-15grtxbruby-terminfo-0.1.1/gems/ruby-terminfo-0.1.1
/usr/bin/ruby2.3 -r ./siteconf20170703-28554-42d6sm.rb extconf.rb
checking for setupterm() in -lncurses... no
checking for setupterm() in -lcurses... no
checking for rb_io_t in ruby.h,rubyio.h... yes
checking for rb_io_t.fd in ruby.h,rubyio.h... yes
checking for OpenFile.fd in ruby.h,rubyio.h... no
creating extconf.h
creating Makefile

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /tmp/bundler20170703-28554-15grtxbruby-terminfo-0.1.1/extensions/x86_64-linux/2.3.0/ruby-terminfo-0.1.1/mkmf.log

current directory: /tmp/bundler20170703-28554-15grtxbruby-terminfo-0.1.1/gems/ruby-terminfo-0.1.1
make "DESTDIR=" clean

current directory: /tmp/bundler20170703-28554-15grtxbruby-terminfo-0.1.1/gems/ruby-terminfo-0.1.1
make "DESTDIR="
compiling terminfo.c
In file included from terminfo.c:33:0:
/usr/include/ruby-2.3.0/ruby/backward/rubyio.h:2:2: warning: #warning use "ruby/io.h" instead of "rubyio.h" [-Wcpp]
 #warning use "ruby/io.h" instead of "rubyio.h"
  ^
terminfo.c:36:20: fatal error: curses.h: No such file or directory
compilation terminated.
Makefile:246: recipe for target 'terminfo.o' failed
make: *** [terminfo.o] Error 1

make failed, exit code 2

Gem files will remain installed in /tmp/bundler20170703-28554-15grtxbruby-terminfo-0.1.1/gems/ruby-terminfo-0.1.1 for inspection.
Results logged to /tmp/bundler20170703-28554-15grtxbruby-terminfo-0.1.1/extensions/x86_64-linux/2.3.0/ruby-terminfo-0.1.1/gem_make.out

An error occurred while installing ruby-terminfo (0.1.1), and Bundler cannot continue.
Make sure that `gem install ruby-terminfo -v '0.1.1'` succeeds before bundling.

In Gemfile:
  ruby-terminfo

Can't install colorls

whe i type: sudo gem install colorls

i get:

Building native extensions.  This could take a while...
ERROR:  Error installing colorls:
	ERROR: Failed to build gem native extension.

    current directory: /var/lib/gems/2.3.0/gems/ruby-terminfo-0.1.1
/usr/bin/ruby2.3 -r ./siteconf20170710-21629-gq9k0b.rb extconf.rb
checking for setupterm() in -lncurses... no
checking for setupterm() in -lcurses... no
checking for rb_io_t in ruby.h,rubyio.h... yes
checking for rb_io_t.fd in ruby.h,rubyio.h... yes
checking for OpenFile.fd in ruby.h,rubyio.h... no
creating extconf.h
creating Makefile

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/ruby-terminfo-0.1.1/mkmf.log

current directory: /var/lib/gems/2.3.0/gems/ruby-terminfo-0.1.1
make "DESTDIR=" clean

current directory: /var/lib/gems/2.3.0/gems/ruby-terminfo-0.1.1
make "DESTDIR="
compiling terminfo.c
In file included from terminfo.c:33:0:
/usr/include/ruby-2.3.0/ruby/backward/rubyio.h:2:2: warning: #warning use "ruby/io.h" instead of "rubyio.h" [-Wcpp]
 #warning use "ruby/io.h" instead of "rubyio.h"
  ^~~~~~~
terminfo.c:36:20: fatal error: curses.h: Arquivo ou diretório não encontrado
 #include <curses.h>
                    ^
compilation terminated.
Makefile:246: recipe for target 'terminfo.o' failed
make: *** [terminfo.o] Error 1

make failed, exit code 2

Gem files will remain installed in /var/lib/gems/2.3.0/gems/ruby-terminfo-0.1.1 for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/ruby-terminfo-0.1.1/gem_make.out

ruby version is 2.3.1, i already tried to rename the folders.

Could not get it up and running on OS X

Good work !

Upon installation of Nerd fonts, colorls is not working for me. Throwing the following error:
screen shot 2017-07-08 at 12 41 25 pm

screen shot 2017-07-08 at 12 45 21 pm

I installed colorls using gem only and nerd fonts using homebrew.
Let me know if you can reproduce it or need any further help from my side on reproducing it.

can't use lc

when i use "lc",it appears this /usr/local/Cellar/ruby/2.4.1_1/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in require': cannot load such file -- colorize (LoadError) from /usr/local/Cellar/ruby/2.4.1_1/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in require'
from /Users/huangda/colorls/colorls.rb:1:in `

'
how to resolve it???

Add CHANGELOG.md

It's quite important to document the changes that were made in each version of the released gem.

Icon didn't display.

I did install gem install colorls.
Then I run lc it shows the list of my files and folders with come color but the icon is not working().
Does anyone know what I did wrong?

Rule out incorrect flags

Redirecting from issue #4

$ lc -a                                                                 123ms  Saturday 01 July 2017 07:53:57 PM IST
colorls/colorls.rb:10:in `open': No such file or directory @ dir_initialize - -a (Errno::ENOENT)
	from colorls/colorls.rb:10:in `entries'
	from colorls/colorls.rb:10:in `initialize'
	from colorls/colorls.rb:121:in `new'
	from colorls/colorls.rb:121:in `block in <main>'
	from colorls/colorls.rb:121:in `each'
	from colorls/colorls.rb:121:in `<main>'

Add an equivalent Python3 script

Suggested by @janga1997 - Rather than having colorls depend on Ruby, a Python script called colorls.py could be made from colorls.rb for making it easier for Pythonists.

My note - Creating a Python script should be easy. Requirements are on 3 libraries - one for colorizing string, one for reading from yaml files, and one for finding the width of current terminal screen. Once this is investigated, translation of colorls.rb to colorls.py line by line should be easy. 🎉

Ping @kaustubhhiware @americast

Add CONTRIBUTORS.md

Because, attribution to open-source contributors is how we return back their ❤️

Add prompt config

A lot of people have been mailing me, asking about how to get their prompt to look like the screenshots. Along with the configurations mentioned in the README, the powerlevel9k config I'm using can be found in this gist. This should also be put up in the README probably, next to the first screenshot. 😄

Identifying folder names separated by spaces

There is some issue related to detecting folders whose names contain spaces.
For instance, a folder named MEGAsync Downloads is displayed in white, which means it is unrecognised.
Since the listing is alphabetical, there is another folder named Downloads way above.

image

Clones in different language

Reason: distributing executable as Ruby gem is notoriously hard to pull off.

Would it be ok if I tried cloning this idea (awesome one, btw) in Golang / Rust / Crystal / Haskell? Basically, any compiled language in which you can simply distribute binaries for different OSes.

Blank line before `lc` output

When lc runs, there's a blank line before any output is printed. I know nothing about ruby - is it possible to remove this, or give an option of removing it (-q or similar)?

Really awesome work though! I'm a sucker for nice terminal enhancements.

colorls only returns folders

I just installed colorls on mac, ruby 2.4.1 via rbenv, and seems to work ok, but it's not showing any .dot file

neither

colorls
colorls -r
colorls -f

return any of them, while ls -altr does

Convert Ruby script to gem

By converting the ruby script to a gem, the bin (shebang) file can directly be accessed by

gem install colorls
lc

Add COVERAGES.md

Alternative: Adding a shell file instead of function

A shell file can be written that contains the basic function written:
ruby /path/to/colorls.rb $1
and straight away sourcing the bash shell itself.

This is just an alternative to the mentioned approach. I'm using fish shell, and as far as I know, writing a function is better compared to aliasing since functions are lazy-loaded, and hence faster than sourcing. So I'm not sure if this should be pursued.

Check for order of data in YAML files

Both aliases.yaml and formats.yaml have a certain order, in which data should be inserted. Both YAML files are key-value hashes, with -

  • aliases.yaml : The values are sorted alphabetically. For each set of keys mapping to a value, those set of keys are also sorted alphabetically.
  • formats.yaml : The keys are sorted alphabetically.

It'd be good to have a (Ruby?) script that automatically checks for this order, and use with Travis CI to decide when PRs are submitted.

Support for -a / --all

Is there a way to do this? a good 3/4 of my home directory are dot files. Right now the output kind of pollutes my screen with a lot more files than I need to look at.

Working with options / flags

ls -l works, but something like lc -l doesn't. Having this feature to highlight file formats in strings would be a great feature.

Identifying file types without an extension

Some files, like Procfile are specific to heroku only, but cannot be identified due to lack of an extension.

Likewise, in certain cases, where the extension itself has dots, like .travis.yml or webpack.tar.gz, the behaviour in this is taken as per the last extension, and not as per the complete one. Could this be of any concern later?

Also, some of the folders, have a unique naming style, like gulpfile.js/, here it is not possible to detect the kind of folder to be rendered (I think a symbol of gulp should be shown here, but that is perhaps nit-picking) since the name might not be specific.

Among the 3 cases pointed out above, the first case could be worked upon. I just wanted to point out the usecases that could be encountered.

Support for -h / --help

This flag option is a standalone one, which can be used to print the various flags and use cases.

Clean up Ruby script

Currently, it's just a Ruby script that works, while following Rubocop styling standards. However, the code can definitely be made better and DRyier.

No icons appear in urxvt

I'm trying to set up colorls on my linux-machine, and so far the application is working, but I lack the knowledge on how to get the icons to appear in my urxvt window.

Here's the font-line from my .Xresources:
URxvt*font: xft:DroidSansMonoForPowerline Nerd Font:pixelsize=15:antialias=true:hinting=true:autohint=true
This line works fine, it uses the proper typeface, but sadly the icons all appear as boxes.

Have I missed something, or is urxvt simply not capable of showing the icons?
2017-07-08-211820_1920x1080_scrot

NilClass Exception on an empty directory

On MacOS when trying to colorls / colorls -r an empty directory, following errors get thrown:

/Users/-/.rvm/gems/ruby-2.3.0/gems/colorls-0.1.4/lib/colorls/core.rb:103:in `in_line': undefined method `+' for nil:NilClass (NoMethodError)
	from /Users/-/.rvm/gems/ruby-2.3.0/gems/colorls-0.1.4/lib/colorls/core.rb:87:in `chunkify'
	from /Users/-/.rvm/gems/ruby-2.3.0/gems/colorls-0.1.4/lib/colorls/core.rb:20:in `ls'
	from /Users/-/.rvm/gems/ruby-2.3.0/gems/colorls-0.1.4/lib/colorls/flags.rb:19:in `process'
	from /Users/-/.rvm/gems/ruby-2.3.0/gems/colorls-0.1.4/exe/colorls:4:in `<top (required)>'
	from /Users/-/.rvm/gems/ruby-2.3.0/bin/colorls:23:in `load'
	from /Users/-/.rvm/gems/ruby-2.3.0/bin/colorls:23:in `<main>'
	from /Users/-/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
	from /Users/-/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>'

Not really a no-go issue, but quite ugly.

Support for -t / --tree

It would be awesome if colorls would have a flag to print a tree output, similar to the tree command.

Getting lots of warnings when attempting to use?

When I install colorls on my mac (with Ruby 2.4.1p111) and use it, it is working, but I get a bunch of warnings?

/usr/local/Cellar/rbenv/1.1.0/versions/2.4.1/lib/ruby/gems/2.4.0/gems/facets-3.1.0/lib/core/facets/filetest/separator_pattern.rb:4: warning: already initialized constant FileTest::SEPARATOR_PATTERN
/usr/local/opt/rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/facets-3.1.0/lib/core/facets/filetest/separator_pattern.rb:4: warning: previous definition of SEPARATOR_PATTERN was here
/usr/local/opt/rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/facets-3.1.0/lib/core/facets/kernel/ergo.rb:29: warning: already initialized constant NilClass::FUNCTOR
/usr/local/Cellar/rbenv/1.1.0/versions/2.4.1/lib/ruby/gems/2.4.0/gems/facets-3.1.0/lib/core/facets/kernel/ergo.rb:29: warning: previous definition of FUNCTOR was here
/usr/local/opt/rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/facets-3.1.0/lib/core/facets/string/bracket.rb:3: warning: already initialized constant String::BRA2KET
/usr/local/Cellar/rbenv/1.1.0/versions/2.4.1/lib/ruby/gems/2.4.0/gems/facets-3.1.0/lib/core/facets/string/bracket.rb:3: warning: previous definition of BRA2KET was here

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.