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 ## Usage
``` ```
h: go to parent dir
j: scroll down j: scroll down
k: scroll up k: scroll up
h: go to parent dir
l: go to child dir l: go to child dir
left: go to parent dir
down: scroll down down: scroll down
up: scroll up up: scroll up
left: go to parent dir
right: go to child dir right: go to child dir
enter: go to child dir/open file enter: go to child dir/open file
backspace: go to parent dir backspace: go to parent dir
g: go to top gg: go to top
G: go to bottom G: go to bottom
t: go to trash ctrl+u: jump up
~: go to home ctrl+d: jump down
t: go to trash dir
~: go to home dir
-: go to previous dir
z: refresh current dir z: refresh current dir
A: show directory disk usage/block size
space: mark file space: mark file
a: mark all files in directory a: mark all files in directory
?: show help
q: exit q: exit
``` ```

14
ccc.c
View file

@ -16,6 +16,7 @@
#include "config.h" #include "config.h"
/* functions' definitions */ /* functions' definitions */
void show_help();
void start_ccc(); void start_ccc();
void change_dir(const char *buf, int selection); void change_dir(const char *buf, int selection);
int mkdir_p(const char *destdir); int mkdir_p(const char *destdir);
@ -243,6 +244,10 @@ int main(int argc, char** argv)
change_dir(p_cwd, 0); change_dir(p_cwd, 0);
break; break;
case '?':
show_help();
break;
/* mark one file */ /* mark one file */
case SPACE: case SPACE:
add_file_stat(get_filepath(current_selection), 1); add_file_stat(get_filepath(current_selection), 1);
@ -314,6 +319,15 @@ int main(int argc, char** argv)
return 0; 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() void start_ccc()
{ {
half_width = COLS / 2; half_width = COLS / 2;