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.
```
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(' ')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```
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.
* delete `#remove` method
* remove `#delete_prefix` spec, it was only used for Ruby < 2.5 (see 86cfa2f5cf)
* add specifications for `#colorize` and `#uniq`
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)
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.
* 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
When trying to `require` a gem running in an unlinked directory, an exception is
thrown because `Dir.pwd` is called (see rubygems/rubygems#3087).
Until the fix lands in an official release, we monkey patch `Dir.pwd` to return
'/' if a `Errno::ENOENT` exception is raised while loading the colorls gem.
This should work for all Unixes. On Windows, this error cannot happen since you
cannot unlink a directory which is still in use by a process.
Fixes#351.
On Unix systems the encoding of file names is specified by the user via the
locale settings.
In order to avoid encoding problems simply read file names in ASCII 8 bit
encoding and try to convert to the external encoding while replacing undefined
characters.
Also, does not show an icon if the external encoding does not support it and
shows a `=` instead of a check mark for git status.
Fixes#352.
git does not report any status for empty directories, and it also does not
report any status for directories without any modified, untracked or ignored
files.
To correctly show the status, we need to check whether the directory is empty if
git did not report any status codes. When empty, show it as "not interesting",
otherwise the "no changes" green check mark is shown.
Note, I am specifically not using the untracked marker, as that would mean there
is some interesting file inside the directory which could be added.
Fixes#334.