Commit graph

272 commits

Author SHA1 Message Date
Claudio Bley
b362fa1eb8 Improve git-status processing
* no longer traverse complete directory trees to determine git status for
  directories

* properly report status for folders with changed files

* skip the parent folder since we do not have git status about it
2018-03-27 19:50:52 +02:00
Andy
bb270b319a Adds some media types (#180)
* add some media types

* alphabetize the media types
2018-02-01 21:43:38 +05:30
Andy
99b94da2f6 add jupyter notebooks to file aliases (#181) 2018-01-30 01:16:55 +05:30
Athitya
0ed7f76b14 Updates to version v1.1.0 2018-01-15 23:46:58 +05:30
Claudio Bley
d12b95da6e Avoid reading link target when not needed
It is only needed in long listing mode.
2018-01-02 11:02:36 +01:00
Claudio Bley
038c15f53c Interprete path with trailing slash as a directory 2018-01-02 11:02:36 +01:00
Claudio Bley
fa803c6cb6 Simplify git info handling 2018-01-02 11:02:36 +01:00
Claudio Bley
68215c56b0 Use porcelain mode with git status, no chdir 2018-01-02 11:02:36 +01:00
Claudio Bley
694fdee03c Use git rev-parse to find git root path 2018-01-02 11:02:36 +01:00
Claudio Bley
f9db84a2b1 Avoid re-computing max_widths 2018-01-02 11:02:36 +01:00
Claudio Bley
a6879dc23d Avoid Time.now call 2018-01-02 11:02:36 +01:00
Claudio Bley
ff7dd59a8c Use information from stat call to colorize user 2018-01-02 11:02:36 +01:00
Claudio Bley
e0ebbdb3d0 Add FileInfo class, reduce syscalls 2018-01-02 11:02:36 +01:00
Claudio Bley
60cc97bbd2 Simplify path handling in Core class 2017-12-10 22:50:13 +01:00
Claudio Bley
1d3bd49f5d Handle errors gracefully
Do not print a backtrace when a `SystemCallError` occurs and keep going to
process arguments afterwards.
2017-12-10 22:50:13 +01:00
Claudio Bley
0c6a174081 Avoid using count if size or length works
According to [1] one should prefer the latter over the former whenever possible.

[1]: http://batsov.com/articles/2014/02/17/the-elements-of-style-in-ruby-number-13-length-vs-size-vs-count/
2017-12-10 10:06:14 +01:00
Claudio Bley
fe78028949 Use IO#winsize instead of calling out to tput
If the window size cannot be determined, use a default of 80 columns, just like
tput.
2017-12-10 10:05:30 +01:00
Claudio Bley
bebe09f5f7 Use clocale gem for proper sorting 2017-12-01 09:05:04 +01:00
Athitya Kumar
60012c93d9
Merge pull request #161 from rohitner/master
Removed bug of ignored files
2017-11-23 03:46:26 +05:30
Claudio Bley
96ec0d5276 Generate Zsh completion file
Add the `_colorls` completion file to the `zsh/` folder of the gem and make the
`tab_complete.sh` script work for Zsh too.
2017-11-22 22:32:20 +01:00
rohitner
1fefca92a9 fixed rubocop issue 2017-11-23 00:10:53 +05:30
rohitner
6deb982c2e fix for partially gitignored dirs 2017-11-23 00:10:36 +05:30
rohitner
e6f0de0679 fix partially ignored files 2017-11-22 19:38:21 +05:30
rohitner
90a296bf35 removed bug of ignored files 2017-11-20 20:57:09 +05:30
Claudio Bley
1b587d8257 Generate man page using ronn 2017-11-17 21:33:44 +01:00
Alex
8dade9d52a Update yaml to proper class. Fix invocations so tests pass 2017-11-07 19:22:37 -05:00
Alex
1cd2029126 Create yaml class and add class methods. Move specs to appropriate folder. Fix method calls. Move flags spec to appropriate folder for rubocop 2017-11-07 19:22:37 -05:00
Claudio Bley
0bc518dda4 Move handling of output mode into core
This prevents giving mutual exclusive options to Core.initialize which could
lead to unexpected results.
2017-11-07 22:38:52 +01:00
Matthew Vincent
ba257b970b Add support for sorting by size
* add `--sort=size` flag
* add `-S` flag
* adjust `.travis.yml` to check the new flags
2017-11-07 22:38:42 +01:00
Claudio Bley
25b21c442a Add support for reverse sorting
Re-assign the `-r` short option from `--report` to `--reverse` and mention this
change in the post install message.
2017-11-07 22:38:42 +01:00
Claudio Bley
2df30f7f33 Add support for sorting by mtime
* add `--sort=WORD` option, which sorts by modification "time" or not at all

* add short option `-U` to mean `--sort=none` (`ls` compatibility)

* `-t` now has the same effect as `--sort=time` which is also mentioned in the
  post install mesage

* add checks for `--sort=time` and `--sort=none` to .travis.yml
2017-11-06 08:42:02 +01:00
Claudio Bley
52badf7ed5 Separate sorting and grouping 2017-11-01 09:14:20 +01:00
Claudio Bley
869dc86d3f Print directory argument before listing contents
If there are a lot of arguments, e.g. due to shell globbing, one might easily
lose track of which output corresponds to which argument.

Again, this is similar to what `ls` does.
2017-11-01 09:07:34 +01:00
Claudio Bley
d48f545344 Sort output by default and re-enable test
When not using any sort options, sort the output by name.

This is in line with what `ls` does, too.

Revert "Disable failing test"

This reverts commit 9e41d60956.
2017-11-01 09:07:34 +01:00
Athitya
e475ba32f2 Updates version to 1.0.9 2017-10-29 05:49:23 +05:30
Athitya
d0a7bba396 Fixes minor chdir issue 2017-10-29 05:43:15 +05:30
Athitya
7543257c7e Removes require call of git gem 2017-10-29 05:39:40 +05:30
Athitya
9dbe6cde49 Adds rubocop fixes 2017-10-29 05:35:57 +05:30
Athitya
919ddb7c4c Adds colors for git-status 2017-10-29 05:34:25 +05:30
Athitya
0984a529ac Adds custom config coloring support for faster git-status 2017-10-29 05:32:38 +05:30
Athitya
a88598e10e Updates version to 1.0.8 2017-10-28 23:05:20 +05:30
Athitya
086cc05adc Fixes minor facets remanant 2017-10-28 23:04:47 +05:30
Athitya
15c5317b1e Updates version to 1.0.7 2017-10-28 22:56:32 +05:30
Athitya
a6a6fffd64 Removes facets dependency 2017-10-28 22:55:05 +05:30
Athitya
b286f71ef0 Adds rake as runtime dependency and updates to 1.0.6 2017-10-28 22:26:39 +05:30
Athitya
aa6920abdc Updates version to 1.0.5 2017-10-28 22:01:56 +05:30
Athitya
5619a5bbf8 Requires monkey patches 2017-10-28 21:58:22 +05:30
Athitya
c9beb097a8 Fixes rubocop issue 2017-10-28 21:36:49 +05:30
Athitya
0501c0b4a2 Adds monkeys.rb, and clean-ups before merging 2017-10-28 21:03:05 +05:30
Athitya
2ea96f1212 Adds support for new inbuilt colors 2017-10-28 20:54:44 +05:30
Athitya
7c6d09c0f7 Fixes --long with --git-status flag combination 2017-10-28 20:10:21 +05:30
Athitya
8e1d16e884 Adds custom config coloring support for git-status 2017-10-28 19:37:51 +05:30
Athitya
1dd794ff23 Adds monkey patch for colorize method 2017-10-28 19:10:10 +05:30
Athitya
aeb3a3950c Switches from colorize to rainbow dependency 2017-10-28 18:21:01 +05:30
Athitya
67d632ffca Updates version to 1.0.4 2017-10-28 16:11:20 +05:30
Claudio Bley
8424e4de27 Use optparse for tab completion (#138) 2017-10-28 16:09:09 +05:30
Athitya
85fa654870 Fixes minor bug with tab completion and updates version to 1.0.3 2017-10-22 23:52:30 +05:30
Athitya
ae20613f94 Updates version to 1.0.2 2017-10-22 23:46:15 +05:30
Athitya
b2fa5f18d7 Fixes minor rubocop offense 2017-10-21 02:58:18 +05:30
Athitya
24406eaa67 Updates version to 1.0.0 2017-10-21 02:48:13 +05:30
Claudio Bley
bf73fd3462 Fixes flag handling issue introduced in PR #129 (#131)
* Fix handling of `--tree` and `--all` / `--allmost_all` flags

When using `:tree` mode, the `:allmost_all` was always enabled unconditionally.

* Add example for combining short options
2017-10-21 02:26:51 +05:30
Claudio Bley
6d4284cc7a Allows specifying mutual exlusive flags (#129)
* Allow specifying mutual exlusive flags

Warning about flags that seem mutual exclusive prevents using default
flags in Shell aliases which later could be overriden.

When parsing the command line options, the last given option for a
setting (think "mode") or (light vs. dark) counts.

Since colorls errors out when `--tree` is used together with `--all`, the
`--all` option is relaxed to `--almost-all`.

This is exactly how it works for `ls` and e.g. the famous curl tool.

Related to #103, in order to make colorls more compatible to `ls`.

* Fix rubocop error: sort dependencies

```
Offenses:

colorls.gemspec:25:3: C: Gemspec/OrderedDependencies: Dependencies should be sorted in an alphabetical order within their section of the gemspec. Dependency filesize should appear before ruby-terminfo.

  spec.add_runtime_dependency 'filesize'

  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

colorls.gemspec:32:3: C: Gemspec/OrderedDependencies: Dependencies should be sorted in an alphabetical order within their section of the gemspec. Dependency diffy should appear before rubocop.

  spec.add_development_dependency 'diffy'

  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```
2017-10-21 00:30:27 +05:30
Claudio Bley
a4c6766141 Improves CLI operation with optparse module (#100)
* Revert commit d3e0cd3bb8

The help will be generated automatically.

* Use optparse module for options parsing

Use the `optparse` module instead of open coding the options parsing.

It can automatically generate a help message about available options, can
generate completion code for Bash and Zsh and also supports clubbed flags like
GNU's `getopt`.
2017-10-18 01:16:06 +05:30
Metamist
3af107627b Added clubbed flags and renamed multi-character shorthand arguments (#125)
* Added clubbed flags and renamed multi-character shorthand arguments to not interfere with clubbed flags

* Cleaned up code

* Fixed parsing arguments without dash

* Made -h flag clubbable

* Minor text fixes

* Cleaned up incompatible flags method
2017-10-07 17:28:13 +05:30
Metamist
8dec4115ef Added colorized file stats depending on size (#123)
* Added colorized file stats depending on size

* Removed redundant return

* Syntax improvements
2017-10-07 01:22:35 +05:30
Mariel Frank
fa1f6394d9 Clean up flags.rb code (#122)
* Clean up flags.rb code

* Remove return from flags.rb line 26.

* Fix Rubocop errors, revert most explicit returns, other requested changes.
2017-10-06 23:38:55 +05:30
Metamist
92d59760d6 Fixed date not showing if file is older than 1 hour (#124) 2017-10-06 21:08:51 +05:30
Athitya Kumar
f8962caedc Tries to fix some bugs of PR #119 2017-10-06 20:50:24 +05:30
Athitya Kumar
f904dea239 Merge pull request #121 from igordcsouza/feature/fix_rubocop_offenses
fix all rubocop offenses
2017-10-05 22:55:58 +05:30
Igor da Cunha Souza
9c43ac8e91 fix all rubocop offenses 2017-10-05 10:41:34 -03:00
Athitya Kumar
0411c41aac Merge pull request #119 from igordcsouza/feature/cleaning
Cleaning some code
2017-10-05 18:40:42 +05:30
Igor da Cunha Souza
afa1a7eb00 revert breaking changes 2017-10-05 10:05:41 -03:00
Anthony Jean
b898af16d5 Add config files support 2017-10-04 22:26:21 -04:00
Igor da Cunha Souza
0d3209e5e3 cleaning 2017-10-04 22:22:34 -03:00
Athitya
8110212143 Adds minor change to output string indent 2017-08-28 20:38:24 +05:30
rohitner
9e5b2276cc colorized the output of git_info 2017-08-28 14:16:13 +05:30
rohitner
b1d0005af9 updated helplog 2017-08-26 21:56:34 +05:30
rohitner
72f3424a0d added -gs flag 2017-08-26 21:40:15 +05:30
rohitner
a0f2079831 replaced slice with remove to check travis build 2017-08-26 19:16:34 +05:30
rohitner
6b14f40331 minor bug fixes and changed rubocop 2017-08-26 18:31:37 +05:30
rohitner
511b7b0c02 added support for git-status in -l command 2017-08-26 16:22:15 +05:30
Khải
e6c55f48cb Add some icons, fix some file icons (#109)
* Add some icons for folders

* Folder names: .atom, .vscode, .github

* Add/Fix some file icons

* New icons:
  - React: .jsx
  - SASS: .sass

* Fixed aliases:
  - .editorconfig: It was a 'git' icon, which makes no sense
  - sass/scss: SCSS is not SASS

* New aliases:
  - Stylus: .stylus → .styl
  - Video: .avi, .mkv, .ogv, .webm → video
  - React: .tsx → .jsx

* Fix alphabetic order
2017-08-25 00:54:49 +05:30
Claudio Bley
438aed19bd Fix long listing of files as arguments
The elements in `@contents` should only ever be names of directory entries.
Otherwise erroneous paths will be constructed with `@input/@content_entry`.

* add check to ensure that long listing prints information about `.hidden-file`

Fixes #104.
2017-08-21 08:42:02 +02:00
Claudio Bley
6fa9ca2112 Only filter hidden files when listing a directory
* add `.hidden-file` to fixtures
* add check that `.hidden-file` is found to .travis.yml

Fixes #101.
2017-08-18 08:41:47 +02:00
Rohit Ner
ae751cc896 Adds --group-directories-first attribute to -sd flag (#98) 2017-08-17 18:27:42 +05:30
Rohit Ner
d3e0cd3bb8 Adds support for -h / --help flag (#97)
* added help flag

* updated .travis.yml

* added the list of all use-case commands

* changed rubocop

* made the necessary minor changes in helplog method and changed rubocop
2017-08-16 07:39:02 +05:30
Gary Traffanstedt
fb40c72b15 Adds env, erb, scss, and slim icons. (#95)
* Added erb, scss, and slim icons.

* Added env icon.

* Aliased erb and slim icons to new rubydoc.
2017-08-03 01:14:08 +05:30
Vladislav Isakov
9b21e7a29f Fixes bug with -l and path to file. Close #89 (#90)
* Fixes bug with -l and path to file. Close #89

* Add use case for -l with path to file
2017-07-27 16:47:25 +05:30
Ryan L McIntyre
bf2fc7ce21 Updates .git folder icon
- Updates .git folder icon from GitHub to more generic
- fixes #33
2017-07-23 11:03:23 -04:00
Athitya
c372b9e6aa Updates to v0.1.7 2017-07-14 11:51:41 +05:30
Athitya
2a86bbd228 Fixes minor bugs in making -l work with -t 2017-07-14 11:46:39 +05:30
Tom Lazar
1afa3aa682 Adds colors.yaml file (#81)
* add colors.yaml file and switch any color reference to use it in
`lib/colors/core.rb`

* add light and dark verions of the commands, also moved load_from_yaml

* fix typo

* add colors for new commands from the merge

* fix name and update colors for the light and dark scheme

* fixed small typo when no files are found
2017-07-14 11:44:17 +05:30
Athitya
9a4445fe46 Updates to v0.1.6 2017-07-13 08:04:01 +05:30
Athitya
b3d97738f3 Fixes double '/' behind dir 2017-07-12 22:20:14 +05:30
Athitya
b2f73068ca Fixes rubocop issue 2017-07-12 22:17:40 +05:30
Athitya Kumar
3a8e722167 Merge branch 'master' into tree-flag 2017-07-12 22:13:01 +05:30
Athitya
e74c915973 Adds working -t / --tree flag 2017-07-12 22:00:59 +05:30
Oskar
1565333cb8 Adds symlink display for -l (#77) 2017-07-12 20:15:23 +05:30
Ace Dimasuhid
d62da43586 Adds -A flag, edits -a flag (#75)
Changes:

* Add -A | --almost-all flag

* Update functionality for -a | --all
2017-07-11 16:08:29 +05:30
sergeant-wizard
d50fcac738 Uses one_per_line if not in TTY environments (#70)
* Use one_per_line if not in TTY environments

* Adds stdout pipe to  command to travis scripts.
2017-07-11 10:00:25 +05:30
Michael Dungan
d0f00a9d6a Adds icon for yarn.lock (#72) 2017-07-11 08:24:28 +05:30
Athitya
f804aade07 Update to v0.1.5 2017-07-10 20:36:42 +05:30
Athitya
e13eb59a28 Fixes bug of different dir with -l flag 2017-07-10 20:29:29 +05:30
GladOSkar
0cc9e16609 made rubocop happy by simplifying init_contents and increasing class
length limit
2017-07-10 15:04:45 +02:00
GladOSkar
e4e794a39d Revert "shorten the catches for user- and group-lookup drastically"
This reverts commit d6e7235672.
2017-07-10 14:59:28 +02:00
GladOSkar
d6e7235672 shorten the catches for user- and group-lookup drastically 2017-07-10 14:41:38 +02:00
GladOSkar
f02ebbe169 move icons to the right for -l 2017-07-10 14:19:00 +02:00
Oskar
56f9cad47c Merge branch 'master' into master 2017-07-10 14:00:34 +02:00
Tomasz
10b2198ec8 Adds support for handling files and globs as input (#65)
* Added support for handling files as input (#58)

* Added usage case to Travis config (#58)
2017-07-10 17:29:34 +05:30
GladOSkar
e75637168d updated gemfile & travis, made rubocop happy 2017-07-10 13:39:52 +02:00
Ace Dimasuhid
a578f7e5da Adds support to icons for specific filenames (#66) 2017-07-10 16:58:58 +05:30
GladOSkar
46f86a44bc add -l / --long flag 2017-07-10 11:35:59 +02:00
Ace Dimasuhid
67f29c278f Update file_aliases.yaml to reflect sorted version 2017-07-10 00:13:14 +08:00
Paulo
52819d3e93 Fixes empty dir bug (#46)
* Add entry to files.yaml to handle .log file

* Update files.yaml, correcting a typo in log entry

* Update on core.rb, to check if the directory is empty

* Update on core.rb, rewrote test, because Travis saw it as an offense

* Update on core.rb, typo in my test

* Update core.rb, switch error message on empty folder
2017-07-09 14:35:18 +05:30
Adnan
0e2cbc852e Adds epub icon (#47) 2017-07-08 09:12:02 +05:30
Athitya
52595c239e Upgrade to v0.1.4 2017-07-07 21:59:07 +05:30
Athitya
69ce52e1ac Adds -a / --all flag support 2017-07-07 21:58:10 +05:30
Athitya
39b7282c8a Updates to gem v0.1.3 2017-07-07 20:19:46 +05:30
Athitya
3bfa362121 Merge branch 'master' into ruby-gem 2017-07-06 20:21:09 +05:30
Athitya
97efea36bf Updates gem to v0.1.1 2017-07-05 22:51:40 +05:30
Athitya
4905321dca Updates Ruby gem for release 0.1.0 2017-07-05 22:15:46 +05:30
Athitya
f993755f0e Adds ruby gem skeleton 2017-07-05 19:53:11 +05:30