Rename threading flag to -t,--threads + update man page

This commit is contained in:
Yorhel 2024-07-18 07:49:41 +02:00
parent 99f92934c6
commit b0d4fbe94f
2 changed files with 17 additions and 4 deletions

16
ncdu.1
View file

@ -18,6 +18,7 @@
.Op Fl \-include\-caches , \-exclude\-caches
.Op Fl L , \-follow\-symlinks , \-no\-follow\-symlinks
.Op Fl \-include\-kernfs , \-exclude\-kernfs
.Op Fl t , \-threads Ar num
.Op Fl 0 , 1 , 2
.Op Fl q , \-slow\-ui\-updates , \-fast\-ui\-updates
.Op Fl \-enable\-shell , \-disable\-shell
@ -147,6 +148,16 @@ The exact counting behavior of this flag is subject to change in the future.
.Pp
The complete list of currently known pseudo filesystems is: binfmt, bpf, cgroup,
cgroup2, debug, devpts, proc, pstore, security, selinux, sys, trace.
.It Fl t , \-threads Ar num
Number of threads to use when scanning the filesystem, currently defaults to 1.
.Pp
In single-threaded mode, the export function (see
.Fl o )
can operate with very little memory, but in multi-threaded mode the entire
directory tree is first constructed in memory and written out after the
filesystem scan has completed,
This causes a delay in output and requires significantly more memory for large
directory trees.
.El
.Ss Interface Options
.Bl -tag -width Ds
@ -159,9 +170,8 @@ When exporting the data with
ncurses will not be initialized at all.
This option is the default when exporting to standard output.
.It Fl 1
Similar to
.Fl 0 ,
but does give feedback on the scanning progress with a single line of output.
Write progress information to the terminal, but don't open a full-screen
ncurses interface.
This option is the default when exporting to a file.
.Pp
In some cases, the ncurses browser interface which you'll see after the

View file

@ -266,6 +266,9 @@ fn argConfig(args: *Args, opt: Args.Option) bool {
else if (std.mem.eql(u8, val, "dark")) config.ui_color = .dark
else if (std.mem.eql(u8, val, "dark-bg")) config.ui_color = .darkbg
else ui.die("Unknown --color option: {s}.\n", .{val});
} else if (opt.is("-t") or opt.is("--threads")) {
const val = args.arg();
config.threads = std.fmt.parseInt(u8, val, 10) catch ui.die("Invalid number of --threads: {s}.\n", .{val});
} else return false;
return true;
}
@ -329,6 +332,7 @@ fn help() noreturn {
\\ -v,-V,--version Print version
\\ -x Same filesystem
\\ -e Enable extended information
\\ -t NUM Number of threads to use
\\ -r Read only
\\ -o FILE Export scanned directory to FILE
\\ -f FILE Import scanned directory from FILE
@ -487,7 +491,6 @@ pub fn main() void {
else if (opt.is("-f")) import_file = allocator.dupeZ(u8, args.arg()) catch unreachable
else if (opt.is("--ignore-config")) {}
else if (opt.is("--quit-after-scan")) quit_after_scan = true // undocumented feature to help with benchmarking scan/import
else if (opt.is("--experimental-threads")) config.threads = std.fmt.parseInt(u8, args.arg(), 10) catch ui.die("Invalid number of threads.\n", .{})
else if (argConfig(&args, opt)) {}
else ui.die("Unrecognized option '{s}'.\n", .{opt.val});
}