1
1
Этот коммит содержится в:
Max Klinger 2015-09-20 01:11:12 +02:00 коммит произвёл Yorhel
родитель 5aeb4f9b09
Коммит c035c3859c
5 изменённых файлов: 14 добавлений и 1 удалений

Просмотреть файл

@ -103,6 +103,11 @@ List sizes using base 10 prefixes, that is, powers of 1000 (KB, MB, etc), as
defined in the International System of Units (SI), instead of the usual base 2 defined in the International System of Units (SI), instead of the usual base 2
prefixes, that is, powers of 1024 (KiB, MiB, etc). prefixes, that is, powers of 1024 (KiB, MiB, etc).
=item --confirm-quit
Requires a confirmation before quitting ncdu. Very helpful when you
accidentally press 'q' during or after a very long scan.
=back =back
=head2 Scan Options =head2 Scan Options

Просмотреть файл

@ -397,7 +397,9 @@ int browse_key(int ch) {
if(info_show) if(info_show)
info_show = 0; info_show = 0;
else else
quit_init(); if (confirm_quit)
quit_init();
else return 1;
break; break;
case 'g': case 'g':
if(++graph > 3) if(++graph > 3)

Просмотреть файл

@ -28,6 +28,7 @@
#include "global.h" #include "global.h"
int confirm_quit;
int browse_key(int); int browse_key(int);
void browse_draw(void); void browse_draw(void);
void browse_init(struct dir *); void browse_init(struct dir *);

Просмотреть файл

@ -90,6 +90,8 @@ extern int read_only;
extern long update_delay; extern long update_delay;
/* filter directories with CACHEDIR.TAG */ /* filter directories with CACHEDIR.TAG */
extern int cachedir_tags; extern int cachedir_tags;
/* flag if we should ask for confirmation when quitting */
extern int confirm_quit;
/* handle input from keyboard and update display */ /* handle input from keyboard and update display */
int input_handle(int); int input_handle(int);

Просмотреть файл

@ -130,6 +130,7 @@ static void argv_parse(int argc, char **argv) {
{ 'X', 1, "-X,--exclude-from" }, { 'X', 1, "-X,--exclude-from" },
{ 'C', 0, "--exclude-caches" }, { 'C', 0, "--exclude-caches" },
{ 's', 0, "--si" }, { 's', 0, "--si" },
{ 'Q', 0, "--confirm-quit" },
{0,0,NULL} {0,0,NULL}
}; };
@ -154,6 +155,7 @@ static void argv_parse(int argc, char **argv) {
printf(" --exclude PATTERN Exclude files that match PATTERN\n"); printf(" --exclude PATTERN Exclude files that match PATTERN\n");
printf(" -X, --exclude-from FILE Exclude files that match any pattern in FILE\n"); printf(" -X, --exclude-from FILE Exclude files that match any pattern in FILE\n");
printf(" --exclude-caches Exclude directories containing CACHEDIR.TAG\n"); printf(" --exclude-caches Exclude directories containing CACHEDIR.TAG\n");
printf(" --confirm-quit Confirm quitting ncdu\n");
exit(0); exit(0);
case 'q': update_delay = 2000; break; case 'q': update_delay = 2000; break;
case 'v': case 'v':
@ -167,6 +169,7 @@ static void argv_parse(int argc, char **argv) {
case '0': dir_ui = 0; break; case '0': dir_ui = 0; break;
case '1': dir_ui = 1; break; case '1': dir_ui = 1; break;
case '2': dir_ui = 2; break; case '2': dir_ui = 2; break;
case 'Q': confirm_quit = 1; break;
case 1 : exclude_add(val); break; /* --exclude */ case 1 : exclude_add(val); break; /* --exclude */
case 'X': case 'X':
if(exclude_addfile(val)) { if(exclude_addfile(val)) {