Comments (8)
Fixed with PR #63. Closing this issue now. Good work, @GladOSkar 👍
from colorls.
I think the information provided by -l / --list
is really helpful, e.g., file permission, file size (when combined with -h / --human-readable
) and the symlink destination.
from colorls.
Hmm, not sure how well it fits in with the other flags. But, it'd definitely fit well as a stand-alone flag.
If anyone likes to work on this issue, please refer to this approach (psuedocode-ish) I haveve in my mind. 😄
output = `ls -l #{input}`
arrays = output.split("\n").map { |line| line.split(' ') }
puts arrays.map do |line|
line.map do |word|
# check if word is a file / directory
# and change it appropriately
# with (color + icon) or just white.
end.join("\t")
end.join("\n")
from colorls.
I would like to work on this.
I am no expert in ruby but rather than parsing ls
(which is apparently discouraged) i would recommend printing all info from File.stat(@input)
since it is all given there.
What do you think?
e.g. stat.mode \t stat.nlink \t Etc.getpwuid(stat.uid).name \t Etc.getpwuid(stat.uid).name \t Etc.getgrgid(stat.gid).name \t Filesize.from("#{stat.size} B").pretty \t stat.mtime \t filename \n
Where stat.mode needs to be prettyfied of course
from colorls.
Hey @allenye0119! Thanks for filing this issue. If this is required, the only way might be to workaround by parsing the output of ls -l
using backticks in Ruby (or similar system calls). Keeping this in mind, do you think -l
/ --list
flag needs to be supported?
from colorls.
I think this was debated at the very start as well. Initially, lc -l
was supported, relevant discussion at #4
from colorls.
@GladOSkar - Yes, I knew that ls parsing is a discouraged approach. But, I wasn't aware of File#stat
method. Sure, go ahead with it. I'm assigning this to you. 😄
from colorls.
+1
from colorls.
Related Issues (20)
- colorls doesnt seem to get installed HOT 1
- Request to implement a option to change hidden dir/ file colors HOT 2
- dark_colors.yaml is used instead of light_colors.yaml
- Integrate Auto Library
- opensuse command defaults to colorls.ruby3.1
- Failing to install colorls on Ubuntu WSL HOT 2
- zsh: /usr/local/bin/colorls: bad interpreter: /usr/bin/ruby2.5: no such file or directory HOT 2
- Option for NOT human readable size - show file size in bytes HOT 5
- Distribute `colorls` as a standalone binary. HOT 2
- Icon for .fileextension HOT 2
- Fedora 37 upgradable for Fedora 38 HOT 1
- collect2 missing error install HOT 1
- Install failure on macOS Monterey M2 Chip HOT 1
- zsh: /usr/local/bin/colorls: bad interpreter: /usr/local/homebrew/opt/[email protected]/bin/ruby: no such file or directory HOT 2
- colorls -h shows help HOT 2
- Rounding bug for large files HOT 1
- How to make colorls running under specific ruby env using ruby-install?
- can't find gem colorls (>= 0.a) with executable colorls (Gem::GemNotFoundException)
- Installation problem on Windows. MSYS2 HOT 2
- Installation failure on MacOS Ventura M1 Pro 10c/16c HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from colorls.