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

Add --human-readable option for compatibility with GNU ls #269

Merged
merged 1 commit into from
Mar 14, 2019

Conversation

avdv
Copy link
Collaborator

@avdv avdv commented Mar 14, 2019

Description

I am using the prezto configuration for Zsh. It automatically provides useful aliases for some ls commands:

alias l='ls -1A'
alias l.='ls -d .* --color=auto'
alias ll='ls -lh'

Some Linux distributions also provide similar (more) aliases for Bash by default.

I did alias ls to colorls of course. 😄

More often than not I find myself running ll to get a long listing of a directory. Alas, since -h means "show help and exit" for colorls I only get to see the help text.

This PR adds the --human-readable option for compatibility to GNU ls and also makes -h the short option corresponding to it (exactly like GNU ls).

Since -h was used to mean "show help and exit" in colorls from the beginning, this change also keeps this effect as a special case if -h is the only argument given to colorls.

  • Relevant Issues : Make colorls a drop-in replacement for ls #103
  • Relevant PRs : (none)
  • Type of change :
    • New feature
    • Bug fix for existing feature
    • Code quality improvement
    • Addition or Improvement of tests
    • Addition or Improvement of documentation

@ghost ghost assigned avdv Mar 14, 2019
@ghost ghost added the review label Mar 14, 2019
* make `-h` an alias for `--human-readable`
* both options are simply ignored when used with an argument or another option
* running `colorls -h` still shows the help text since just as before
@codecov-io
Copy link

codecov-io commented Mar 14, 2019

Codecov Report

Merging #269 into master will decrease coverage by 7.17%.
The diff coverage is 63.63%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #269      +/-   ##
==========================================
- Coverage    84.9%   77.72%   -7.18%     
==========================================
  Files           7        7              
  Lines         424      431       +7     
==========================================
- Hits          360      335      -25     
- Misses         64       96      +32
Impacted Files Coverage Δ
lib/colorls/flags.rb 78.07% <63.63%> (-5.11%) ⬇️
lib/colorls/monkeys.rb 75% <0%> (-15%) ⬇️
lib/colorls/core.rb 80.82% <0%> (-9.59%) ⬇️
lib/colorls/fileinfo.rb 75.75% <0%> (-3.04%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3fb9046...6d6d121. Read the comment docs.

@avdv avdv merged commit 5b7b583 into athityakumar:master Mar 14, 2019
@ghost ghost removed the review label Mar 14, 2019
@avdv avdv deleted the ignore-h-option branch March 14, 2019 14:28
@avdv avdv mentioned this pull request Mar 14, 2019
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants