use '?' to show usage and update readme with usage

This commit is contained in:
Night Kaly 2024-03-20 16:03:54 +00:00
parent d429cbe594
commit b459866236
No known key found for this signature in database
GPG key ID: 8E829D3381CFEBBE
2 changed files with 25 additions and 5 deletions

View file

@ -49,29 +49,35 @@ $ sudo make install
## Usage
```
h: go to parent dir
j: scroll down
k: scroll up
h: go to parent dir
l: go to child dir
left: go to parent dir
down: scroll down
up: scroll up
left: go to parent dir
right: go to child dir
enter: go to child dir/open file
backspace: go to parent dir
g: go to top
gg: go to top
G: go to bottom
t: go to trash
~: go to home
ctrl+u: jump up
ctrl+d: jump down
t: go to trash dir
~: go to home dir
-: go to previous dir
z: refresh current dir
A: show directory disk usage/block size
space: mark file
a: mark all files in directory
?: show help
q: exit
```

14
ccc.c
View file

@ -16,6 +16,7 @@
#include "config.h"
/* functions' definitions */
void show_help();
void start_ccc();
void change_dir(const char *buf, int selection);
int mkdir_p(const char *destdir);
@ -243,6 +244,10 @@ int main(int argc, char** argv)
change_dir(p_cwd, 0);
break;
case '?':
show_help();
break;
/* mark one file */
case SPACE:
add_file_stat(get_filepath(current_selection), 1);
@ -314,6 +319,15 @@ int main(int argc, char** argv)
return 0;
}
void show_help() {
wclear(directory_content);
wclear(preview_content);
wprintw(directory_content,"h: go to parent dir\nj: scroll down\nk: scroll up\nl: go to child dir\n\nleft: go to parent dir\ndown: scroll down\nup: scroll up\nright: go to child dir\n\nenter: go to child dir/open file\nbackspace: go to parent dir\n\ngg: go to top\nG: go to bottom\n\nctrl+u: jump up\nctrl+d: jump down\n\nt: go to trash dir\n~: go to home dir\n-: go to previous dir\nz: refresh current dir\n\nA: show directory disk usage/block size\nspace: mark file\na: mark all files in directory\n\n?: show help\nq: exit");
wpprintw("Visit https://github.com/piotr-marendowski/ccc or use 'man ccc' for help");
wrefresh(directory_content);
wrefresh(preview_content);
}
void start_ccc()
{
half_width = COLS / 2;