Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
nccf
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
702
Provoz
nccf
Commits
88c8f13c
Commit
88c8f13c
authored
3 years ago
by
Yorhel
Browse files
Options
Downloads
Patches
Plain Diff
Add CLI options for default sort
parent
900d31f6
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ncdu.pod
+14
-0
14 additions, 0 deletions
ncdu.pod
src/main.zig
+29
-1
29 additions, 1 deletion
src/main.zig
with
43 additions
and
1 deletion
ncdu.pod
+
14
−
0
View file @
88c8f13c
...
...
@@ -230,6 +230,20 @@ Set to I<off> to disable the shared size column for directories, I<shared>
to display unique directory sizes as a separate column. These options can also
be cycled through in the browser with the 'u' key.
=item --sort I<COLUMN>
Change the default column to sort on. Accepted values are I<disk-usage> (the
default), I<name>, I<apparent-size>, I<itemcount> or I<mtime>. The latter only
makes sense in extended mode, see C<-e>.
The column can be suffixed with I<-asc> or I<-desc> to set the order to
ascending or descending, respectively. e.g. C<--sort=name-desc> will sort by
name in descending order.
=item --group-directories-first, --no-group-directories-first
Sort (or not) directories before files.
=item --confirm-quit, --no-confirm-quit
Require a confirmation before quitting ncdu. Very helpful when you accidentally
...
...
This diff is collapsed.
Click to expand it.
src/main.zig
+
29
−
1
View file @
88c8f13c
...
...
@@ -305,7 +305,35 @@ pub fn main() void {
else
if
(
opt
.
is
(
"--hide-graph"
))
config
.
show_graph
=
false
else
if
(
opt
.
is
(
"--show-percent"
))
config
.
show_percent
=
true
else
if
(
opt
.
is
(
"--hide-percent"
))
config
.
show_percent
=
false
else
if
(
opt
.
is
(
"--shared-column"
))
{
else
if
(
opt
.
is
(
"--group-directories-first"
))
config
.
sort_dirsfirst
=
true
else
if
(
opt
.
is
(
"--no-group-directories-first"
))
config
.
sort_dirsfirst
=
false
else
if
(
opt
.
is
(
"--sort"
))
{
var
val
:
[]
const
u8
=
args
.
arg
();
var
ord
:
?
config
.
SortOrder
=
null
;
if
(
std
.
mem
.
endsWith
(
u8
,
val
,
"-asc"
))
{
val
=
val
[
0
..
val
.
len
-
4
];
ord
=
.
asc
;
}
else
if
(
std
.
mem
.
endsWith
(
u8
,
val
,
"-desc"
))
{
val
=
val
[
0
..
val
.
len
-
5
];
ord
=
.
desc
;
}
if
(
std
.
mem
.
eql
(
u8
,
val
,
"name"
))
{
config
.
sort_col
=
.
name
;
config
.
sort_order
=
ord
orelse
.
asc
;
}
else
if
(
std
.
mem
.
eql
(
u8
,
val
,
"disk-usage"
))
{
config
.
sort_col
=
.
blocks
;
config
.
sort_order
=
ord
orelse
.
desc
;
}
else
if
(
std
.
mem
.
eql
(
u8
,
val
,
"apparent-size"
))
{
config
.
sort_col
=
.
size
;
config
.
sort_order
=
ord
orelse
.
desc
;
}
else
if
(
std
.
mem
.
eql
(
u8
,
val
,
"itemcount"
))
{
config
.
sort_col
=
.
items
;
config
.
sort_order
=
ord
orelse
.
desc
;
}
else
if
(
std
.
mem
.
eql
(
u8
,
val
,
"mtime"
))
{
config
.
sort_col
=
.
mtime
;
config
.
sort_order
=
ord
orelse
.
asc
;
}
else
ui
.
die
(
"Unknown --sort option: {s}.
\n
"
,
.
{
val
});
}
else
if
(
opt
.
is
(
"--shared-column"
))
{
const
val
=
args
.
arg
();
if
(
std
.
mem
.
eql
(
u8
,
val
,
"off"
))
config
.
show_shared
=
.
off
else
if
(
std
.
mem
.
eql
(
u8
,
val
,
"shared"
))
config
.
show_shared
=
.
shared
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment