Skip to content
Snippets Groups Projects
Commit c035c385 authored by Max Klinger's avatar Max Klinger Committed by Yorhel
Browse files

implement confirmation switch

parent 5aeb4f9b
No related branches found
No related tags found
No related merge requests found
......@@ -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
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
=head2 Scan Options
......
......@@ -397,7 +397,9 @@ int browse_key(int ch) {
if(info_show)
info_show = 0;
else
quit_init();
if (confirm_quit)
quit_init();
else return 1;
break;
case 'g':
if(++graph > 3)
......
......@@ -28,6 +28,7 @@
#include "global.h"
int confirm_quit;
int browse_key(int);
void browse_draw(void);
void browse_init(struct dir *);
......
......@@ -90,6 +90,8 @@ extern int read_only;
extern long update_delay;
/* filter directories with CACHEDIR.TAG */
extern int cachedir_tags;
/* flag if we should ask for confirmation when quitting */
extern int confirm_quit;
/* handle input from keyboard and update display */
int input_handle(int);
......
......@@ -130,6 +130,7 @@ static void argv_parse(int argc, char **argv) {
{ 'X', 1, "-X,--exclude-from" },
{ 'C', 0, "--exclude-caches" },
{ 's', 0, "--si" },
{ 'Q', 0, "--confirm-quit" },
{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(" -X, --exclude-from FILE Exclude files that match any pattern in FILE\n");
printf(" --exclude-caches Exclude directories containing CACHEDIR.TAG\n");
printf(" --confirm-quit Confirm quitting ncdu\n");
exit(0);
case 'q': update_delay = 2000; break;
case 'v':
......@@ -167,6 +169,7 @@ static void argv_parse(int argc, char **argv) {
case '0': dir_ui = 0; break;
case '1': dir_ui = 1; break;
case '2': dir_ui = 2; break;
case 'Q': confirm_quit = 1; break;
case 1 : exclude_add(val); break; /* --exclude */
case 'X':
if(exclude_addfile(val)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment