Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ls: list file arguments in columns #967

Merged
merged 1 commit into from
Feb 26, 2025
Merged

Conversation

mknos
Copy link
Contributor

@mknos mknos commented Feb 26, 2025

  • Test case: "perl ls spell ar ar ."
  • The argument list is split into files and directories
  • File arguments are listed first in multi-column output, followed by each directory argument
  • Previously List() was called once per file argument; this was incorrect because List() is unable to format the arguments together in columns
  • Fix this by preparing a sorted file list and attribute hash (containing stat() data), then calling List() once
  • DirEntries() has to be called once per file, then the stat data returned is merged into a single hash
  • Bump version
%perl  ls spell ar ar .
ar     ar     spell                                                                                                           

.:
YES.diff        clear           fish            ls.diffe        ppt             spell           unpar
_die.log        cmp             fmt             ls.orig         pr              split           unshar
addbib          col             fold            ls2             prices          strings         uudecode
apply           colrm           fortune         mail            primes          sum             uuencode
ar              comm            from            maze            printenv        tac             wc
arch            cp              glob            mimedecode      printf          tail            what
arithmetic      cut             grep            mkdir           pwd             tar             which
asa             date            hangman         mkfifo          rain            tee             whoami
awk             dc              head            moo             random          test            whois
bad.diffe       deroff          hexdump         morse           rev             test.pl         words
banner          diff            id              morse2          rm              time            wump
base64          dirname         install         names           rmdir           touch           xargs
basename        du              join            nl              rnd.bin         tr              yes
bc              echo            kill            od              robots          true            yes.ORig
bcd             ed              ln              par             rot13           tsort           yes.Orig
cal             env             lock            paste           s.ORig          tty             yes.diff
cat             expand          look            patch           s.Orig          txt1            yes.orig
chgrp           expr            ls              perldoc         s.orig          uname           yes.rej
chgrp.orig      factor          ls.ORIG         perlpowertools  seq             unexpand        yes2
ching           false           ls.ORIg         pig             shar            uniq            
chmod           file            ls.ORig         ping            sleep           units           
chown           find            ls.Orig         pom             sort            unlink          

%ls spell ar ar . # GNU output is equivalent, aside from different column widths
ar  ar  spell

.:
addbib      cat         dc        find     kill      mimedecode      pig       rmdir    sum      uname     words
apply       chgrp       deroff    fish     ln        mkdir           ping      rnd.bin  tac      unexpand  wump
ar          chgrp.orig  _die.log  fmt      lock      mkfifo          pom       robots   tail     uniq      xargs
arch        ching       diff      fold     look      moo             ppt       rot13    tar      units     yes
arithmetic  chmod       dirname   fortune  ls        morse           pr        seq      tee      unlink    yes2
asa         chown       du        from     ls2       morse2          prices    shar     test     unpar     yes.diff
awk         clear       echo      glob     ls.diffe  names           primes    sleep    test.pl  unshar    YES.diff
bad.diffe   cmp         ed        grep     ls.orig   nl              printenv  s.orig   time     uudecode  yes.orig
banner      col         env       hangman  ls.Orig   od              printf    s.Orig   touch    uuencode  yes.Orig
base64      colrm       expand    head     ls.ORig   par             pwd       s.ORig   tr       wc        yes.ORig
basename    comm        expr      hexdump  ls.ORIg   paste           rain      sort     true     what      yes.rej
bc          cp          factor    id       ls.ORIG   patch           random    spell    tsort    which
bcd         cut         false     install  mail      perldoc         rev       split    tty      whoami
cal         date        file      join     maze      perlpowertools  rm        strings  txt1     whois

* Test case: "perl ls spell ar ar ."
* The argument list is split into files and directories
* File arguments are listed first in multi-column output, followed by each directory argument
* Previously List() was called once per file argument; this was incorrect because List() is unable to format the arguments together in columns
* Fix this by preparing a sorted file list and attribute hash (containing stat() data), then calling List() once
* DirEntries() has to be called once per file, then the stat data returned is merged into a single hash
* Bump version
@github-actions github-actions bot added Priority: low get to this whenever Status: needs verification issue needs to be verified Type: bug an existing feature does not work Type: enhancement improve a feature that already exists Program: ls The ls program labels Feb 26, 2025
@mknos mknos temporarily deployed to automated_testing February 26, 2025 02:14 — with GitHub Actions Inactive
@mknos mknos temporarily deployed to automated_testing February 26, 2025 02:14 — with GitHub Actions Inactive
@mknos mknos temporarily deployed to automated_testing February 26, 2025 02:14 — with GitHub Actions Inactive
@mknos mknos temporarily deployed to automated_testing February 26, 2025 02:14 — with GitHub Actions Inactive
@mknos mknos temporarily deployed to automated_testing February 26, 2025 02:14 — with GitHub Actions Inactive
@mknos mknos temporarily deployed to automated_testing February 26, 2025 02:14 — with GitHub Actions Inactive
@mknos mknos temporarily deployed to automated_testing February 26, 2025 02:14 — with GitHub Actions Inactive
@mknos mknos temporarily deployed to automated_testing February 26, 2025 02:14 — with GitHub Actions Inactive
@mknos mknos temporarily deployed to automated_testing February 26, 2025 02:14 — with GitHub Actions Inactive
@mknos mknos temporarily deployed to automated_testing February 26, 2025 02:14 — with GitHub Actions Inactive
@mknos mknos temporarily deployed to automated_testing February 26, 2025 02:15 — with GitHub Actions Inactive
@mknos mknos temporarily deployed to automated_testing February 26, 2025 02:15 — with GitHub Actions Inactive
@mknos mknos temporarily deployed to automated_testing February 26, 2025 02:15 — with GitHub Actions Inactive
@mknos mknos temporarily deployed to automated_testing February 26, 2025 02:15 — with GitHub Actions Inactive
@mknos mknos temporarily deployed to automated_testing February 26, 2025 02:15 — with GitHub Actions Inactive
@mknos mknos temporarily deployed to automated_testing February 26, 2025 02:15 — with GitHub Actions Inactive
@mknos mknos temporarily deployed to automated_testing February 26, 2025 02:15 — with GitHub Actions Inactive
@mknos mknos temporarily deployed to automated_testing February 26, 2025 02:15 — with GitHub Actions Inactive
@mknos mknos temporarily deployed to automated_testing February 26, 2025 02:15 — with GitHub Actions Inactive
@mknos mknos temporarily deployed to automated_testing February 26, 2025 02:15 — with GitHub Actions Inactive
@coveralls
Copy link

coveralls commented Feb 26, 2025

Pull Request Test Coverage Report for Build 13535065421

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.7%) to 72.349%

Totals Coverage Status
Change from base Build 13523294333: -0.7%
Covered Lines: 348
Relevant Lines: 481

💛 - Coveralls

@briandfoy briandfoy self-assigned this Feb 26, 2025
@briandfoy briandfoy removed the Type: enhancement improve a feature that already exists label Feb 26, 2025
@briandfoy briandfoy merged commit 676ccde into briandfoy:master Feb 26, 2025
23 of 24 checks passed
@github-actions github-actions bot added Status: accepted The fix is accepted and removed Status: needs verification issue needs to be verified Priority: low get to this whenever labels Feb 26, 2025
@briandfoy
Copy link
Owner

changes: improve multi-columnar output

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Program: ls The ls program Status: accepted The fix is accepted Type: bug an existing feature does not work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants