Commit Graph

56 Commits

Author SHA1 Message Date
Ben S
8b520edf3d Only display the year if it's last year
Otherwise, just display the hour and minute.
2015-02-09 18:14:05 +00:00
Ben S
bc7492e7e6 Add hour and minute to timestamps 2015-02-09 17:55:55 +00:00
Ben S
bf815afa8e Use short month names to make them line up 2015-02-09 17:37:02 +00:00
Ben S
0d25a90ef1 Initial work on date/time columns for files
Using the datetime crate, add an extra column to the --long view that
prints out the modified, accessed, or created timestamp for each file.
Also, let the user pick which one they want to see based on the --time
command-line option.
2015-02-09 16:33:27 +00:00
Ben S
42ae7b3d33 Refactor the code after tree view changes
- Turn the views and main program loop into structs, rather than just as one gigantic function
- Separate views into their own files

The addition of the git column and the tree view meant that a lot of functions now just took extra arguments that didn't seem to fit. For example, it didn't really work to have only one 'view' method that printed out everything, as the different view options now all take different parameters.
2015-02-05 14:39:56 +00:00
Ben S
1bced1423b Fix tests from tree view fallout 2015-02-04 01:12:08 +00:00
Ben S
827a1e11fd Make filename not a column
FileName was always a special-cased column, as it was assumed to be the last column in the output. Now, it's explicitly marked as such. This allows the hash marks to be placed before the filename, rather than at the start of the line.
2015-02-03 13:48:39 +00:00
Ben S
5099b3f119 Initial tree implementation
There's still a lot to do, but this is actually *something*. The tree hierarchy is displayed using hashes at the start of a line. I want to have it just before the filename, but this will need some changes to the way that columns are handled.
2015-02-03 13:27:23 +00:00
Ben S
10096d1043 Prevent crash for filenames with no components
Now there are no more unwrap()s!
2015-01-31 17:18:53 +00:00
Ben S
6d4b30d531 Code changes in preparation for recursion 2015-01-31 16:10:40 +00:00
Ben S
947087567c Upgrade to latest Rust
- Rename std::io to std::old_io
2015-01-28 16:55:34 +00:00
Ben S
f794f5eda6 Implement Git status for directories 2015-01-28 10:43:19 +00:00
Ben S
90d4684de4 Preliminary Git support!
This is something that I've long wanted to add. It uses libgit2 as an optional dependency.
2015-01-27 15:01:17 +00:00
Ben S
e835fe8fe3 Make all fields of Dir private 2015-01-26 17:26:11 +00:00
Ben S
da9d1f77d9 Cache the lowercased extension
Extensions aren't ever displayed in lowercase, just compared case-insensitively, so this makes sense.
2015-01-26 01:16:19 +00:00
Benjamin Sago
628d90fe44 Test extension extraction 2015-01-25 13:47:07 +00:00
Benjamin Sago
ef4428fab1 Test highlighting of groups and group names 2015-01-25 13:43:44 +00:00
Benjamin Sago
191c0e5b90 Test highlighting of usernames 2015-01-25 13:04:15 +00:00
Benjamin Sago
c53a0156e6 Extract symlink stuff into its own method 2015-01-24 17:34:33 +00:00
Benjamin Sago
449592c150 Do column width calculations ourselves (speedup)
Instead of stripping the ANSI formatting characters from our strings, work out the length without them and use that. This is per-column, but most of them are simple (just the same number of characters in the non-coloured string).

Sometimes, this is really simple: for example, trwxrwxrwx permissions strings are always going to be ten characters long, and the strings that get returned are chock full of ANSI escape codes.

This should have a small benefit on performance.
2015-01-24 17:26:26 +00:00
Ben S
2ba0b3bd5f Convert docs to standard format 2015-01-24 12:38:05 +00:00
Ben S
0e473bf37b Upgrade to latest Rust, and move options code 2015-01-23 19:27:06 +00:00
Benjamin Sago
1c5409e253 Upgrade to Rust alpha
- uint -> usize
- getopts Cargo library
- replace feature gates with unstable APIs
2015-01-12 01:31:24 +01:00
Ben S
d400231de5 Upgrade to latest Rust
Also, remove dependency on the Regex library by replacing the one place it was used with standard code that should hopefully be faster anyway.
2015-01-05 14:41:43 +00:00
Ben S
a871a448be Add --bytes to not use prefixes at all 2014-12-18 07:04:31 +00:00
Ben S
f03a496424 Only underline executable *files* in perms view 2014-12-18 07:00:51 +00:00
Ben S
24628f97be Use number_prefix crate for number prefixes 2014-12-18 07:00:31 +00:00
Ben S
bcaed1ff35 Remove redundant slicing 2014-12-12 14:17:57 +00:00
Ben S
57430dbbe5 Why be so specific?
Different types of user caches could come in the future...
2014-12-12 14:13:08 +00:00
Ben S
66339e7a15 Miscellaneous little optimisations
- Prefer iter over into_iter where appropriate
- Cut down on cloning
2014-12-12 14:06:48 +00:00
Ben S
65f124fe39 Use the natord library instead of our own sorter
I'm serious, the more functionality I can use external crates for, the better.
2014-12-12 11:26:18 +00:00
Ben S
6770ac5475 Replare Unix module with users crate
Feels good turning all that code into a dependency!
2014-12-12 11:17:55 +00:00
Ben S
6134096586 Upgrade to latest Rust
I can't complain, because the breaking changes were caused by my pull request...
2014-12-02 14:20:28 +00:00
Ben S
8b3602f20f Remove unused lifetime 2014-11-26 07:40:52 +00:00
Ben S
05dd644c92 Upgrade to latest ansi_term
Yeah, I broke my own code again.
2014-11-26 07:36:09 +00:00
Ben S
6ade060eb6 Use curlies consistently 2014-11-25 20:50:23 +00:00
Ben S
bcaf54d7dd Add a flag to print directories as files
Also, re-use the stat result from directory-checking.
2014-11-25 01:27:26 +00:00
Ben S
cbd2f1fa37 List files and directories separately
This finally fixes the issue where trying to list a file causes a crash. Also, tidy up some of the uses of references.
2014-11-24 17:03:36 +00:00
Ben S
d72be30c30 Reduce unnecessary String allocations
- Remove uses of to_string() on a &str where it wasn't necessary
- Use SendStr to reduce allocations further
2014-11-24 02:01:08 +00:00
Ben S
c75bbf7f79 Add path to symlinks 2014-11-24 01:48:51 +00:00
Ben S
03ecb8c9e1 Fix bug with empty directories 2014-11-24 01:24:45 +00:00
Ben S
d7b8b230ef Remove containers from file name in grid view
What a strange bug to happen
2014-11-23 21:57:33 +00:00
Ben S
933f98d2c3 Upgrade to latest Rust nightly 2014-11-23 21:29:11 +00:00
Ben S
fb8821164c Misc style changes 2014-07-22 22:27:37 +01:00
Ben S
44a9819417 Add --oneline option
Also, rename old 'lines' view to 'details' which makes more sense
2014-07-22 20:47:30 +01:00
Ben S
cf3e32c9c1 Get terminal width for grid view (resolve #1) 2014-07-22 15:41:20 +01:00
Ben S
4cbc1f063a Upgrade to latest Rust nightly
- Lifetime changes in unix.rs
- lexical_ordering -> cmp
- from_utf8_lossy got moved into String
- vec.get(n) -> vec[n]
2014-07-21 22:05:04 +01:00
Ben S
90099f28cf Upgrade to latest Rust nightly
- change to_string() on numbers to to_str()
2014-07-10 22:20:52 +01:00
Ben S
92ccf821ff Colour file names in grid view 2014-07-06 18:00:27 +01:00
Ben S
cfb0fa9b72 Import Paint trait from rust-ansi-term 2014-07-04 09:54:14 +01:00