Commit graph

331 commits

Author SHA1 Message Date
Gavin Panella
20e469e804 Use another Display value, as suggested by @meain. 2019-05-21 12:08:10 +02:00
Gavin Panella
65b6acc58e Accept -d/--directory-only option. 2019-05-21 12:08:10 +02:00
Atanas Yankov
79416127c8 Print errors to stderr 2019-05-17 20:26:41 +02:00
Atul Bhosale
f619dc07d6 Format code using 'cargo fmt' 2019-05-17 19:59:19 +02:00
Daniel
c4505e61f8 Changed to Self keyword to satisfy clippy 2019-04-10 15:23:16 +02:00
Daniel
6569a5162e Ported icon tests to Windows 2019-04-10 15:23:16 +02:00
Daniel
f56d9188b3 Ported name tests to Windows 2019-04-10 15:23:16 +02:00
Daniel
36f7b35025 Ported date tests to Windows 2019-04-10 15:23:16 +02:00
Daniel
625f4924f8 Ported filetype tests to Windows 2019-04-10 15:23:16 +02:00
Daniel
39b73daadf Tweaked sort test to work on Windows
Windows doesn't have `touch`, but it does have Powershell, which can
also change timestamps. The relevant command is:

$(Get-Item name).lastwritetime=$(Get-Date "MM/DD/YYYY")
2019-04-10 15:23:16 +02:00
Daniel
82bd588a05 Fixed warnings on Windows 2019-04-10 15:23:16 +02:00
Daniel
289e906478 Added basic FileType::new() implementation
Nothing fancy; it just avoids using the Unix FileTypeExt. Device files,
sockets, and pipes aren't a part of the regular file tree on Windows, so
it makes sense to ignore them for now.
2019-04-10 15:23:16 +02:00
Daniel
9316300adf Implemented get_file_data
Also added a few supporting functions.

Every unsafe block (and there are many) has a list of assumptions that
must be true. Most of them are easy to verify: for example, almost all
pointers indicate something in the *sd_ptr buffer, which lives until the
very end. The rest of the pointers are to something Rust allocated, so
they'll also live to the end of the function.
2019-04-10 15:23:16 +02:00
Daniel
95c7679985 Added utilities for working win Windows API calls 2019-04-10 15:23:16 +02:00
Daniel
038f318ad3 Tests compile on Windows
Just shut off a bunch of test sections. Probably most can remain as long
as some of them get broken out into separate unix-only test sections.
2019-04-10 15:23:16 +02:00
Daniel
0f2f3ca12a Added Owner::new() constructor
This allows the Owner to be constructed from the raw strings by the
Windows code.
2019-04-10 15:23:16 +02:00
Daniel
63b2955d3f Added winapi dependency 2019-04-10 15:23:16 +02:00
Daniel
6a022c01bf Compiles on Windows with new windows_utils module
windows_utils will be responsible for safely wrapping WinAPI calls. This
should result in minimal changes to the interfaces of the existing
modules: all that is needed is new (very simple) constructors.
2019-04-10 15:23:16 +02:00
João Costa
0dbc3b3a62 Make the --tree flag respect the --group-dirs value 2019-04-07 20:33:42 +02:00
H. Emre ARI
fa77894e61 change match to if for display enum 2019-04-01 20:42:04 +02:00
H. Emre ARI
9abab3fb65 add Display enum 2019-04-01 20:42:04 +02:00
H. Emre ARI
e33cde9248 fix wrong names 2019-04-01 20:42:04 +02:00
H. Emre ARI
ecec3ec9e5 add overrides_with to -a and -A flag 2019-04-01 20:42:04 +02:00
H. Emre ARI
d8eaecd30a add almost-all flag 2019-04-01 20:42:04 +02:00
H. Emre ARI
4485087759 fix crash when given file doesn't exist 2019-04-01 20:42:04 +02:00
H. Emre ARI
b0c75f47cf add almost-all flag 2019-04-01 20:42:04 +02:00
H. Emre ARI
709c139dd4 remove if-else check from mod and almost-all flag from flags 2019-04-01 20:42:04 +02:00
H. Emre ARI
cda15d1714 fix lsd -lh .. crash 2019-04-01 20:42:04 +02:00
H. Emre ARI
d35afe5d66 fix typo 2019-04-01 20:42:04 +02:00
H. Emre ARI
429fa52838 fix issue about --all option when displaying . and .. 2019-04-01 20:42:04 +02:00
H. Emre ARI
e5f3a27ce2 show current and parent directory issue#112 2019-04-01 20:42:04 +02:00
Abin Simon
fa6146cc5c change size option 'small' to 'short' 2019-03-30 16:27:15 +01:00
Abin Simon
e6de6d54f0 add a new way to style size 2019-03-29 17:11:48 +01:00
Abin Simon
854ed96594 change from two spaces to one 2019-03-29 11:30:37 +05:30
Abin Simon
0d20479c0f stick to user colors for permissions 2019-03-29 11:30:37 +05:30
Abin Simon
2426efd5b0 bugfix: only one value for multi value options in clap 2019-03-27 14:10:38 +01:00
Matthias Beyer
bd25db9a04 Add "manual" clap alias for -A
This is requested as a feature, but because clap does not support
"short" aliases, we have to create another clap argument for this.

Not the best possible way to implement this (because the best way would
be to patch clap itself to allow short aliases) but the fastest one.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-03-15 14:16:39 +05:30
Abin Simon
3477b6e723 refactor how width is computed for colored strings 2019-03-12 12:01:19 +01:00
Peltoche
c6dcf2ed0f Fall back on epoch if the modification time is invalid
This allow to avoid a panic each time it try to read a broken file.
2019-03-12 10:00:39 +01:00
Abin Simon
c9b3550f61 fix spacing issue on colors 2019-03-11 18:01:36 +01:00
Peltoche
27d57b2b86 Handle all the color code format for the visible width calculation 2019-03-11 18:01:36 +01:00
Sebastian Zivota
e05b389986 Added Layout enum 2019-03-11 13:25:30 +01:00
Abin Simon
deea0df83d do not pass tense explicitly 2019-03-06 15:12:29 +01:00
Daniel Thomsen
0498ebd46c Add -h arg for ls compatibility 2019-03-06 09:53:29 +01:00
Ryan O'Beirne
9ec57c47b2 Use package description in clap 2019-02-26 13:14:45 +01:00
Abin Simon
67bf8d742e Update tests to work with LSCOLORS update
Added another enum value to Theme `NoLscolors`.
As of right now it only helps with tests, but maybe useful for something
in future.

Colouring based on LSCOLORS should be tested in the package so we should
be good.
2019-02-17 12:17:29 +01:00
Abin Simon
aba3e96a28 color files with lscolors 2019-02-17 12:17:29 +01:00
Abin Simon
e8015ebd3e switch to one line when not outputting to tty 2019-02-16 13:11:28 +01:00
Peltoche
e4882c5c99 Fix the module import paths 2019-02-16 11:34:33 +01:00
Sebastian Zivota
e1138bbec3 Refactored classic mode 2019-02-03 12:04:37 +01:00
Sebastian Zivota
1b7eec351c Added --classic flag 2019-02-03 12:04:37 +01:00
Peltoche
0fa68098e2 Improve the tree display 2019-01-23 23:09:34 +01:00
Peltoche
a17eb10656 Fix the permissions 2019-01-23 10:57:09 +01:00
Peltoche
6bdf9ca3c2 Fix a panic with multiple icon options 2019-01-22 19:36:12 +01:00
Peltoche
c4a99ed8f4
big refacto 2019-01-22 17:51:40 +01:00
Peltoche
581ff0920b Handle the errors into the core 2019-01-22 17:48:07 +01:00
Sebastian Zivota
70af39ed0a Added data to File and Dir variants of Elem, FileType enums
This obviates the need for separate variants for such things as
executableness and setuid.
2019-01-20 11:45:24 +01:00
Sebastian Zivota
0d215dca50 Added SetuidDir and SetuidFile variants to Elem and FileType
This allows us to display files and directories that have the uid
flag set with a red background.
2019-01-20 11:45:24 +01:00
Sebastian Zivota
5ad0fb1b21 Added unicode symbols in comments 2019-01-19 11:57:27 +01:00
Sebastian Zivota
5151446fcb Added default icons to Icons struct
Also added tests for unicode icon set
2019-01-19 11:57:27 +01:00
Sebastian Zivota
390f5e4280 Renamed theme flag to icon-theme and default option to fancy 2019-01-19 11:57:27 +01:00
Sebastian Zivota
bc3e47c6d7 Added --theme option to select icon theme
Possible values are `default` and `unicode`.
2019-01-19 11:57:27 +01:00
Sebastian Zivota
662f3ddf38 Added Unicode icon set
It's just an icon set with empty icon maps, so everything should
fall through to the default folder/file icons.
2019-01-19 11:57:27 +01:00
Peltoche
092c961ea7 Do not panic in case of broken pipe 2019-01-16 15:06:01 +01:00
Peltoche
92d018255a Add the directory-order flag 2019-01-12 16:42:05 +01:00
Peltoche
5f50be78e9 Fix the --icon=never in case of no tty 2019-01-12 12:13:29 +01:00
cat12079801
d8d91051ec delete "yarn.lock" from Icons::get_default_icons_by_extension() 2018-12-27 17:39:28 +01:00
cat12079801
389d46c3a6 use "if" instead of "match" 2018-12-27 17:39:28 +01:00
cat12079801
2c4e69c906 Icon in test code changed to Unicode code 2018-12-27 17:39:28 +01:00
cat12079801
972991d484 Add some tests for Icons::get 2018-12-27 17:39:28 +01:00
cat12079801
748b9c0368 Check directory first 2018-12-27 17:39:28 +01:00
cat12079801
c7c795856f Fix wrong indent 2018-12-27 17:39:28 +01:00
Pierre Peltier
92af678167 Update --depth help messages
Co-Authored-By: jorpic <jorpic@gmail.com>
2018-12-27 14:44:17 +01:00
Max Taldykin
c74b5d619e Add a depth parameter for the -R and --tree options 2018-12-27 14:44:17 +01:00
Peltoche
ac82815c19 Do not panic if the group name is not available 2018-12-27 13:08:58 +01:00
Peltoche
e30ac3827a Fix the get_visible_width with no color set 2018-12-20 17:23:36 +01:00
Kenta Kubo
a8162471bc Remove unused import 2018-12-20 14:01:03 +01:00
Kenta Kubo
c1a3ef81ac cargo fmt src/display.rs 2018-12-20 14:01:03 +01:00
Kenta Kubo
1ecbdeef46 Add tests for Display::get_visible_width 2018-12-20 14:01:03 +01:00
Kenta Kubo
fca6498d99 Use unicode-width crate to count width of filename 2018-12-20 14:01:03 +01:00
Peltoche
f162a677dd Fix the name ordering 2018-12-17 11:43:28 +01:00
boxdot
af9a24b490 Fix usage of touch in test. 2018-12-16 14:26:11 +01:00
boxdot
0eef7aea59 Make sure that mod time of file in the test is before dir created. 2018-12-16 14:26:11 +01:00
boxdot
9a83bda871 Review improvements + unittest of sorting. 2018-12-16 14:26:11 +01:00
boxdot
8e331ff566 Fix test. 2018-12-16 14:26:11 +01:00
boxdot
3514d79642 Add options to sort by time and to reverse sorting order. 2018-12-16 14:26:11 +01:00
Peltoche
cd586b330c
Remove a println 2018-12-15 09:29:02 +01:00
Peltoche
0c877b1cdb Fix a multi icon issue 2018-12-14 17:07:52 +01:00
Peltoche
d781e49c67 Add several icons 2018-12-14 17:07:52 +01:00
Peltoche
629c934c58 Make the clippy lints available for older compilers 2018-12-14 16:20:22 +01:00
Peltoche
be41956919 Fix the lint errors 2018-12-14 16:20:22 +01:00
Peltoche
8bc3686f66 Implement the Default trait to Flags 2018-12-14 14:32:18 +01:00
Peltoche
9173f8d36f Add tests for the Indicator struct 2018-12-14 14:32:18 +01:00
Peltoche
22b4f0f816 Add a test on relative date flag 2018-12-14 14:32:18 +01:00
Peltoche
377f0c950f Accept the same flag several times 2018-12-14 13:24:59 +01:00
Peltoche
f0a4fa125c Add the --icon flag 2018-12-13 16:08:01 +01:00
Abin Simon
f31afa8ab7 Add option to show relative date 2018-12-13 12:27:54 +01:00
Abin Simon
2548af1218 Use print instead of println to display output
Avoid the extra line being printed at the end
2018-12-13 10:52:56 +01:00
Peltoche
abf66f6d6f Fix some icons tests 2018-12-12 16:21:54 +01:00
Peltoche
fb0f6cdaad
Change the file icon for an empty one 2018-12-12 11:48:44 +01:00
Peltoche
1ef1904bd3 Add a custom color for all the special fils (char / pipe / block) 2018-12-12 11:46:50 +01:00
Peltoche
78f13841e8 Run cargo fmt 2018-12-12 11:46:50 +01:00
Unknown
917498022e Fixes 2018-12-12 10:27:19 +01:00
Unknown
29ee29eccc Fixed tests 2018-12-12 10:27:19 +01:00
Your Name
52ac556c08 Merge conflicts 2018-12-12 10:27:19 +01:00
Your Name
feb581c2d7 Move icon rendering logic to name 2018-12-12 10:27:19 +01:00
Your Name
5c3c6a55fc Also color icon 2018-12-12 10:27:19 +01:00
Your Name
447b0e93c3 Code Review 2018-12-12 10:27:19 +01:00
Your Name
dc720e5403 Color executable files green 2018-12-12 10:27:19 +01:00
Peltoche
9ffffe854e Fix name order case sensitivity 2018-12-10 22:34:50 +01:00
Peltoche
98f59b3e2e Add tests for the date, name and filetype modules 2018-12-10 20:35:46 +01:00
Peltoche
b56df8ec56 Implement the -F flag 2018-12-10 19:03:48 +01:00
Abin Simon
7eb3ad7af6 add None in Unit enum to handle non file items 2018-12-10 10:45:37 +01:00
Abin Simon
cbcf0a332a use option for size values instead of size 2018-12-10 10:45:37 +01:00
Abin Simon
355091b301 show - for size when if it is not a file 2018-12-10 10:45:37 +01:00
LippyBoy
55546fbc50 Add rust and swift icons 2018-12-09 13:01:07 +01:00
Peltoche
340641f615
Remove the fallback symlink icon 2018-12-09 12:43:06 +01:00
Peltoche
deb03c5c53 Lint everything 2018-12-08 23:22:08 +01:00
Peltoche
8bc324ccc7 Add a symlink icon 2018-12-08 23:22:08 +01:00
Peltoche
d72b3544a9 Make the symlinks more visible 2018-12-08 23:22:08 +01:00
Peltoche
a006824f37 Refactore the icon package 2018-12-08 22:38:08 +01:00
Peltoche
0cee42aa69 Add the --color flag support 2018-12-08 14:54:18 +01:00
Peltoche
7e158ae6b9 Create the flags package and move the Options struct into it 2018-12-08 14:54:18 +01:00
Peltoche
66a5ae6366 Remove some Symlink logic from the Batch struct 2018-12-08 13:21:14 +01:00
Peltoche
f843e6db72 Change the display order 2018-12-07 20:20:31 +01:00
Peltoche
98bc907101 Add a complete CD
This commit include the features:
- The version is available with `lsd --version`
- Create the completions scripts for bash/fish/zsh/powershell
- Return an error during the build if the rust requirements are not ok.
- Add the binaries into the releases assets
- Fix Size for the i686 architectures
2018-12-06 19:13:39 +01:00
Peltoche
15b968ec4e Add help texts to the cli 2018-12-06 14:55:53 +01:00
Peltoche
21111ff316 Use print_one_per_line if no tty is available 2018-12-05 21:30:14 +01:00
Peltoche
55fc49f8cd Add the theme support to the Colors struct 2018-12-05 21:30:14 +01:00
Peltoche
268f7bf79f Escape invalid unicode encoded names 2018-12-05 21:19:02 +01:00
Peltoche
526f020695 Do not colorize when the stdout is not a tty 2018-12-05 20:25:48 +01:00
Peltoche
55c61722f3 Fix the tests 2018-12-05 11:37:34 +01:00
Yann Leretaille
dba7022a85 fixes #11 2018-12-05 10:23:44 +01:00
Peltoche
aa7a54f703 Fix the broken symlinks fetching 2018-12-04 21:10:42 +01:00
Peltoche
5b75642e66
Fix a typo
Thanks to Bourgond_Aries for the report!
2018-12-04 17:24:41 +01:00
Peltoche
b60bab1bdd
Handle the --tree option 2018-12-04 14:54:56 +01:00
Peltoche
8989ca44fe
Add the --recursive option 2018-12-04 13:29:54 +01:00
Peltoche
823b04a258
Handle correctly the special files metadata fetching 2018-12-04 11:15:05 +01:00
Peltoche
228a5bb11a
Handle the symlinks with relatif paths 2018-12-04 10:57:54 +01:00
Peltoche
fbf8dacbc6
Handle broken symlinks 2018-12-03 13:27:06 +01:00
Peltoche
a4a494a5bc
Add the -1 option 2018-12-02 18:19:57 +01:00
Peltoche
9e16d6620b
Display all the batch a once 2018-12-02 18:16:02 +01:00
Peltoche
e425bd9d3a
Use ANSIString for rendering 2018-12-02 18:13:46 +01:00
Peltoche
e375a19f5b
Add the Display struct 2018-12-02 17:22:51 +01:00
Peltoche
2d6627ce7f
Create the Batch struct 2018-12-02 15:05:27 +01:00
Peltoche
0bd3ce5b31
Create the Name struct 2018-12-01 18:59:53 +01:00
Peltoche
f542fef68d
Create the Date struct 2018-12-01 17:56:07 +01:00
Peltoche
a7aff583f3
Create the Owner struct 2018-12-01 17:15:55 +01:00
Peltoche
8a0f253f16
Handle all the file types (block/char/pipe/etc) 2018-12-01 16:51:39 +01:00
Peltoche
033181ca9b
Add the file_type into the Permission struct 2018-12-01 14:16:23 +01:00
Peltoche
21cc041775
Add the setuid/setgid/sticky bit support 2018-12-01 13:21:39 +01:00
Peltoche
25c615002e
Add the Size.render method 2018-12-01 12:34:16 +01:00
Peltoche
8585369bf1
Run clippy 2018-12-01 12:11:01 +01:00
Peltoche
ba980f0da1
Move the permission login into the permissions package 2018-12-01 12:10:12 +01:00
Peltoche
af5809c4e7
Implement the From<Metadata> trait for Size 2018-12-01 11:27:46 +01:00
Peltoche
f1fec9352d
Fix the file size values 2018-11-30 14:53:54 +01:00
Peltoche
83cb7672ad
Update the colors to use Fixed 2018-11-26 14:22:42 +01:00
Peltoche
8d15f4b1f3
Add some comments 2018-11-25 17:07:28 +01:00
Peltoche
c4fef17476
Add the .cfg icon 2018-11-25 16:40:12 +01:00
Peltoche
95306a0b05
Manage symlink into the file ordering 2018-11-25 16:37:30 +01:00
Peltoche
1c852cab1c
Add the node type at before the permissions 2018-11-25 16:30:43 +01:00
Peltoche
6199c8d888
Remove the spaces at the beginning of the long format 2018-11-25 16:16:22 +01:00
Peltoche
e5c21c659c
Fix compilation bug 2018-11-25 16:16:09 +01:00
Peltoche
fa58b3c011
Add the node_type field into the Meta struct 2018-11-25 16:12:13 +01:00
Peltoche
de3a3afeb7
Improve ls indentation with term_grid 2018-11-25 15:56:39 +01:00
Peltoche
6ecd04e8c7
Delete the logos.rs file 2018-11-25 12:17:26 +01:00
Peltoche
19ac609ea6
Rename the logo package to the icon package 2018-11-25 12:16:24 +01:00
Peltoche
0efa7bfc9a
Add a '/' at the end of the dir names 2018-11-24 19:45:05 +01:00
Peltoche
b71204e158
Improve the icons detection 2018-11-24 19:44:42 +01:00
Peltoche
125cfbaa19
Add ls without the -l flag 2018-11-24 17:42:39 +01:00
Peltoche
cd3dc39f03
Move the colors into a separate package 2018-11-24 15:57:12 +01:00
Peltoche
916fde2523
Rename LongMeta to Meta 2018-11-24 15:53:46 +01:00
Peltoche
cdd9dc1a70
Restore the -a option 2018-11-24 15:50:26 +01:00
Peltoche
b0adc11215
Separate the meta into a new package 2018-11-24 15:43:04 +01:00
Peltoche
e72fef2f4f
Separate the logo logic into a separate type 2018-11-24 14:42:57 +01:00
Peltoche
1f64ced9d9
Run clippy lint 2018-11-24 13:30:29 +01:00
Peltoche
30709497de
Add the icons next to the file names 2018-11-24 13:05:44 +01:00
Peltoche
052e1321a5
Save the name into the Meta struct 2018-11-24 12:35:19 +01:00
Peltoche
5b9d87a74f
Add some details on panics 2018-11-24 12:02:39 +01:00
Peltoche
4b9568510c
Change a lot of stuff
This is a shitty comment, I know...
2018-11-16 14:19:07 +01:00
Peltoche
3dc1689e65
Add the first functionalities 2018-11-12 13:34:25 +01:00