Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add time to dir entry #215

Merged
merged 7 commits into from
Jul 26, 2021
Merged

Add time to dir entry #215

merged 7 commits into from
Jul 26, 2021

Conversation

vinc
Copy link
Owner

@vinc vinc commented Jul 26, 2021

No description provided.

@vinc vinc changed the title Add creation time to dir entry Add time to dir entry Jul 26, 2021
@vinc
Copy link
Owner Author

vinc commented Jul 26, 2021

Storing modification time rather than creation time might be more useful.

@vinc
Copy link
Owner Author

vinc commented Jul 26, 2021

Output of list command:

> list /tmp
5083 2021-07-26 18:34:30 alice.txt
   0 2021-07-26 18:35:29 example
 118 2021-07-26 18:34:30 fibonacci.lisp
  13 2021-07-26 18:35:48 hello.txt

The file example is a directory and will appear in blue. Directories don't have size because their dir entry in their parent dir (if they have one) is not changed when a file is added at the moment.

@vinc
Copy link
Owner Author

vinc commented Jul 26, 2021

Next step is to add a sort parameter to the list command to do list --sort name (the default), list --sort size, and list --sort time. At some point we'll also need a getopt equivalent!

@vinc
Copy link
Owner Author

vinc commented Jul 26, 2021

> list /tmp --sort time
5083 2021-07-26 18:34:30 alice.txt
 118 2021-07-26 18:34:30 fibonacci.lisp
   0 2021-07-26 18:35:29 example
  13 2021-07-26 18:35:48 hello.txt

> list /tmp --sort size
   0 2021-07-26 18:35:29 example
  13 2021-07-26 18:35:48 hello.txt
 118 2021-07-26 18:34:30 fibonacci.lisp
5083 2021-07-26 18:34:30 alice.txt

> list /tmp --sort name
5083 2021-07-26 18:34:30 alice.txt
   0 2021-07-26 18:35:29 example
 118 2021-07-26 18:34:30 fibonacci.lisp
  13 2021-07-26 18:35:48 hello.txt

@vinc
Copy link
Owner Author

vinc commented Jul 26, 2021

And now with shortcut params!

> l -t /tmp
5083 2021-07-26 18:34:30 alice.txt
 118 2021-07-26 18:34:30 fibonacci.lisp
   0 2021-07-26 18:35:29 example
  13 2021-07-26 18:35:48 hello.txt

> l -s /tmp
   0 2021-07-26 18:35:29 example
  13 2021-07-26 18:35:48 hello.txt
 118 2021-07-26 18:34:30 fibonacci.lisp
5083 2021-07-26 18:34:30 alice.txt

> l -n /tmp
5083 2021-07-26 18:34:30 alice.txt
   0 2021-07-26 18:35:29 example
 118 2021-07-26 18:34:30 fibonacci.lisp
  13 2021-07-26 18:35:48 hello.txt

@vinc vinc marked this pull request as ready for review July 26, 2021 19:47
@vinc vinc merged commit bbcfc66 into master Jul 26, 2021
@vinc vinc deleted the feature/add-creation-time-to-dir-entry branch July 26, 2021 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant