Giter Club home page Giter Club logo

Comments (8)

athityakumar avatar athityakumar commented on May 18, 2024 2

Fixed with PR #63. Closing this issue now. Good work, @GladOSkar 👍

from colorls.

allenye0119 avatar allenye0119 commented on May 18, 2024 1

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.

athityakumar avatar athityakumar commented on May 18, 2024 1

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.

GladOSkar avatar GladOSkar commented on May 18, 2024 1

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.

athityakumar avatar athityakumar commented on May 18, 2024

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.

kaustubhhiware avatar kaustubhhiware commented on May 18, 2024

I think this was debated at the very start as well. Initially, lc -l was supported, relevant discussion at #4

from colorls.

athityakumar avatar athityakumar commented on May 18, 2024

@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.

craftzdog avatar craftzdog commented on May 18, 2024

+1

from colorls.

Related Issues (20)

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.