Commit graph

233 commits

Author SHA1 Message Date
goar5670
fb102b1700 Account for git status and inode in item widths 2022-03-20 01:55:33 +03:00
goar5670
793cd20cc8 Add basic --inode flag 2022-03-20 01:54:58 +03:00
Claudio Bley
a3b94311ec Allow git status to be different for items in directories
If a directory was reported with a concrete status by git, it was
assumed that all files below this directory would have the same status.

This is not the case were git ignore files are applied to some files
in subdirectories.

Fixes #461.
2022-03-19 09:20:03 +01:00
bl7awy
29f2162a77 Edit --report flag description 2022-03-18 22:59:27 +03:00
bl7awy
c4f3885410 Add the option for a short report 2022-03-18 18:02:46 +03:00
Claudio Bley
3995f3173c Drop support for Ruby 2.5
It reached EOL with release 2.5.9, and no longer receives patches.
2022-02-28 09:17:26 +01:00
Claudio Bley
74b20cf371
Merge pull request #481 from t-mangoe/customize-time-format 2022-02-15 16:42:40 +01:00
Claudio Bley
ec4ea6e830 Auto-correct Performance/StringIdentifierArgument offense 2022-01-02 23:12:14 +01:00
t-mangoe
90aaa4d0b6 change time/date format in '+FORMAT' 2021-11-13 09:21:15 +09:00
t-mangoe
d7e7ddd01e add --time-style option in long style format 2021-10-02 08:40:48 +09:00
Claudio Bley
c9f93173e6 Fix Lint/AmbiguousOperatorPrecedence offenses 2021-09-14 13:49:50 +02:00
gheritarish
f5cd4e6695
add LibreOffices extensions to alias file 2021-09-04 10:25:01 +02:00
Claudio Bley
34ff868bbc
Merge pull request #462 from t-mangoe/trailing-directory-backslash 2021-07-19 10:39:27 +02:00
t-mangoe
00f503c09f add a description of the --indicator-style option 2021-07-19 10:35:08 +02:00
t-mangoe
566ea3b45a add '--indicator-style' option 2021-07-19 10:24:25 +02:00
Claudio Bley
0f0efc0151 Fix Layout/LineEndStringConcatenationIndentation offenses 2021-06-30 13:26:48 +02:00
Claudio Bley
22fb57ac21 Use console_size if console is nil
When running on github actions CI, there is no proper tty / console.
2021-05-06 14:24:47 +02:00
Claudio Bley
155bfdaf1c Fix offense detected by Style/StringChars cop 2021-03-25 08:29:44 +01:00
Claudio Bley
ae5b6c8962 Fix encoding error with UTF-8 directory name
Fixes #449
2021-03-24 21:45:30 +01:00
Claudio Bley
aca55532b6 Prepare release 1.4.4 2021-03-10 21:14:54 +01:00
dependabot-preview[bot]
adb19ab3c3 Update rubocop-performance requirement from ~> 1.9.0 to ~> 1.10.1
Updates the requirements on [rubocop-performance](https://github.com/rubocop/rubocop-performance) to permit the latest version.
- [Release notes](https://github.com/rubocop/rubocop-performance/releases)
- [Changelog](https://github.com/rubocop/rubocop-performance/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop-performance/compare/v1.9.0...v1.10.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-03-08 08:46:35 +01:00
Felix Dombek
6ebb1ef6db Add support for executable_file color 2021-03-03 01:14:42 +01:00
Claudio Bley
17b2142c48 Use File.extname to determine file extension
Fixes #441.
2021-01-29 10:21:24 +01:00
Claudio Bley
0048e3883a Group and process arguments in groups of files and directories
Fixes #233
2021-01-15 11:03:21 +01:00
Claudio Bley
4612549bc2 Fix misalignment of git status indicators
The misalignment is caused when a `!` is part of the status
which is later replaced with a space.
2021-01-15 11:03:21 +01:00
Claudio Bley
2eeb30fc44 Refactor git_subdir_status
Instead of simply returning the opened pipe, consume the output
and yield the `mode, file` tuple to the given block.
2021-01-15 11:03:21 +01:00
Claudio Bley
373fb67003 Fix error when git is not installed 2021-01-15 11:03:21 +01:00
Claudio Bley
93b08f9403 Prefer require_relative for internal dependencies 2021-01-15 11:03:21 +01:00
Claudio Bley
0ad630da4c Properly encode hyperlinks with special characters
This also works on Windows now, since absolute paths include a colon after the
drive letter, the `file:` URI needs to start with a triple slash.
2021-01-15 11:03:21 +01:00
Claudio Bley
76f148cc55 Only show a single report at the end
Showing a report for every argument given on the command line
is not suitable when using wildcards and did not work with `--tree`.

Also, it was only designed to work with directories given as
arguments.
2020-12-23 22:32:36 +01:00
Claudio Bley
ca9e1cd5d9 Refactor file_color method 2020-12-22 14:02:46 +01:00
Claudio Bley
d0df25d35d Re-use CoreLS::Core instance
Only initialize colors and flags once.
2020-12-22 14:01:55 +01:00
Claudio Bley
77b5135d97 Remove unused return value 2020-12-11 08:51:03 +01:00
Claudio Bley
41d9f5a757 Extract screen_width into the module 2020-12-11 08:51:03 +01:00
Claudio Bley
019158c63c Prepare release 1.4.3 2020-12-07 23:22:34 +01:00
Claudio Bley
64a42c105d
Merge pull request #417 from t-mangoe/add-option-o-g
add -o and -g options.
2020-12-07 22:54:17 +01:00
t-mangoe
0d0a1d96ca add -G option 2020-12-05 09:14:12 +09:00
Claudio Bley
1795844679 Fix rubocop offense about redundant argument for String#split
```
lib/colorls/core.rb:213:14: C: Style/RedundantArgument: Argument ' ' is
redundant because it is implied by default.
      size = Filesize.from("#{filesize} B").pretty.split(' ')
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```
2020-11-26 09:07:58 +01:00
Claudio Bley
67ee23069c Take display width of characters into account
Some Unicode characters, e.g. chinese, consume more space when displayed on a terminal
than a single roman character. To avoid alignment issues, try to determine the width
using the unicode-display_width gem.
2020-11-22 21:29:51 +01:00
t-mangoe
39be15c6aa add -o and -g options. 2020-11-21 10:17:32 +09:00
Claudio Bley
6c697cdb9e Remove symbolize_keys monkey method on Hash
Usage in a single place does not really warrant a monkey patch and it
can be replaced with `transform_keys!` easily.
2020-11-02 08:45:07 +01:00
Claudio Bley
a59258b749 Clean up monkey patches
* delete `#remove` method
* remove `#delete_prefix` spec, it was only used for Ruby < 2.5 (see 86cfa2f5cf)
* add specifications for `#colorize` and `#uniq`
2020-11-02 08:45:07 +01:00
dependabot-preview[bot]
dc12307f19
Merge pull request #407 from athityakumar/dependabot/bundler/rubocop-tw-1.1.0 2020-10-31 21:29:31 +00:00
Claudio Bley
12e3b67d56 Fix Lint/EmptyBlock offense 2020-10-31 22:19:37 +01:00
Claudio Bley
8035deaab0 Ensure to use file_encoding for arguments
Fixes #377
2020-10-31 21:54:45 +01:00
t-mangoe
9992218ea4 make executables bold 2020-10-17 15:15:39 +09:00
Claudio Bley
d4110e4ac7 Officially support Windows
On Windows, MRI Ruby uses the `FindFirstFileW` et. al. kind of functions with
wide character paths and constantly converts from multi-byte to wide character
encoding back and forth when calling any methods on `File` or `Dir`.

This means that when using `Encoding::ASCII_8BIT` for reading directory entries,
that this does not round trip properly, if a file name contains unicode
characters. That is because Ruby assumes the path string is encoded in Windows
Codepage 1252[1].

* skip symlink test if files were checked out from git as textual symlinks on
  Windows
* use UTF-8 encoding on Windows, since this properly round-trips between
  multi-byte and wide character encoding
* travis: windows job no longer is allowed to fail

[1]: 946cd6c534/win32/file.c (L131-L134)
2020-10-09 18:26:50 +02:00
t-mangoe
64b1891c2c Set exit status code when specified path doesn't exist
Similar to GNU ls, status code `2` is reported if an argument given on the
command line does not exist.

Close #397
2020-10-07 09:58:01 +02:00
Claudio Bley
52b8c3489d Fix unrecognized files count and colorization
A *file* is assigned a generic icon / glyph in `files.yaml`, so looking up
`:file` in the corresponding hash always succeeds, but `:file` is also used as
the fallback key if a file's extension is not recognized.

First determining the color and group of a given file before falling back to
the `:file` key fixes this issue.
2020-09-07 20:38:42 +02:00
Claudio Bley
8379ba64db Fix newly reported offenses
* Style/MultilineWhenThen: Do not use then for multiline when statement
* Style/StringConcatenation: Prefer string interpolation to string concatenation
* Style/OptionalBooleanParameter: Use keyword arguments when defining method with boolean argument
* Style/GlobalStdStream: Use $stderr instead of STDERR
* Style/GlobalStdStream: Use $stdout instead of STDOUT
2020-09-03 23:18:18 +02:00