mirror of
https://github.com/jarun/nnn.git
synced 2024-11-28 05:41:31 +00:00
Show modification time in detail view
This commit is contained in:
parent
3c94193992
commit
187835c2bb
|
@ -36,7 +36,7 @@ I chose to fork noice because:
|
||||||
- Jump to home directory
|
- Jump to home directory
|
||||||
- Filter contents in current directory
|
- Filter contents in current directory
|
||||||
- Show/hide hidden files
|
- Show/hide hidden files
|
||||||
- Sort entries by time modified (newest to oldest)
|
- Sort entries by modification time (newest to oldest)
|
||||||
- Spawn a shell in current directory
|
- Spawn a shell in current directory
|
||||||
- Run `top`
|
- Run `top`
|
||||||
- Open a file with `vim` or `less`
|
- Open a file with `vim` or `less`
|
||||||
|
@ -44,7 +44,11 @@ I chose to fork noice because:
|
||||||
### Fork toppings
|
### Fork toppings
|
||||||
|
|
||||||
- Behaviour and navigation
|
- Behaviour and navigation
|
||||||
- Detail view with file type, size and number of entries in dir (default: disabled)
|
- Detail view (default: disabled) with:
|
||||||
|
- file type
|
||||||
|
- modification time
|
||||||
|
- human-readable file size
|
||||||
|
- number of entries in current directory
|
||||||
- Case-insensitive alphabetic content listing instead of upper case first
|
- Case-insensitive alphabetic content listing instead of upper case first
|
||||||
- Roll over at the first and last entries of a directory (with Up/Down keys)
|
- Roll over at the first and last entries of a directory (with Up/Down keys)
|
||||||
- Sort entries by file size (largest to smallest)
|
- Sort entries by file size (largest to smallest)
|
||||||
|
|
27
noice.c
27
noice.c
|
@ -17,6 +17,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
|
@ -452,24 +453,30 @@ coolsize(off_t size)
|
||||||
void
|
void
|
||||||
printent_long(struct entry *ent, int active)
|
printent_long(struct entry *ent, int active)
|
||||||
{
|
{
|
||||||
|
static char buf[18];
|
||||||
|
static struct tm *p;
|
||||||
|
|
||||||
|
p = localtime(&ent->t);
|
||||||
|
strftime(buf, 18, "%b %d %H:%M %Y", p);
|
||||||
|
|
||||||
if (S_ISDIR(ent->mode))
|
if (S_ISDIR(ent->mode))
|
||||||
printw("%s%-32.32s D\n", active ? CURSR : EMPTY, ent->name);
|
printw("%s%-32.32s D %-18.18s\n", active ? CURSR : EMPTY, ent->name, buf);
|
||||||
else if (S_ISLNK(ent->mode))
|
else if (S_ISLNK(ent->mode))
|
||||||
printw("%s%-32.32s L\n", active ? CURSR : EMPTY, ent->name);
|
printw("%s%-32.32s L %-18.18s\n", active ? CURSR : EMPTY, ent->name, buf);
|
||||||
else if (S_ISSOCK(ent->mode))
|
else if (S_ISSOCK(ent->mode))
|
||||||
printw("%s%-32.32s S\n", active ? CURSR : EMPTY, ent->name);
|
printw("%s%-32.32s S %-18.18s\n", active ? CURSR : EMPTY, ent->name, buf);
|
||||||
else if (S_ISFIFO(ent->mode))
|
else if (S_ISFIFO(ent->mode))
|
||||||
printw("%s%-32.32s F\n", active ? CURSR : EMPTY, ent->name);
|
printw("%s%-32.32s F %-18.18s\n", active ? CURSR : EMPTY, ent->name, buf);
|
||||||
else if (S_ISBLK(ent->mode))
|
else if (S_ISBLK(ent->mode))
|
||||||
printw("%s%-32.32s B\n", active ? CURSR : EMPTY, ent->name);
|
printw("%s%-32.32s B %-18.18s\n", active ? CURSR : EMPTY, ent->name, buf);
|
||||||
else if (S_ISCHR(ent->mode))
|
else if (S_ISCHR(ent->mode))
|
||||||
printw("%s%-32.32s C\n", active ? CURSR : EMPTY, ent->name);
|
printw("%s%-32.32s C %-18.18s\n", active ? CURSR : EMPTY, ent->name, buf);
|
||||||
else if (ent->mode & S_IXUSR)
|
else if (ent->mode & S_IXUSR)
|
||||||
printw("%s%-32.32s E %s\n", active ? CURSR : EMPTY, ent->name,
|
printw("%s%-32.32s E %-18.18s %s\n", active ? CURSR : EMPTY, ent->name,
|
||||||
coolsize(ent->size));
|
buf, coolsize(ent->size));
|
||||||
else
|
else
|
||||||
printw("%s%-32.32s R %s\n", active ? CURSR : EMPTY, ent->name,
|
printw("%s%-32.32s R %-18.18s %s\n", active ? CURSR : EMPTY, ent->name,
|
||||||
coolsize(ent->size));
|
buf, coolsize(ent->size));
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
Loading…
Reference in a new issue