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
46b88bcb
Commit
46b88bcb
authored
2 years ago
by
Yorhel
Browse files
Options
Downloads
Patches
Plain Diff
Add --(enable|disable)-natsort options
parent
ca1f2933
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
ncdu.pod
+4
-0
4 additions, 0 deletions
ncdu.pod
src/browser.zig
+4
-4
4 additions, 4 deletions
src/browser.zig
src/main.zig
+3
-0
3 additions, 0 deletions
src/main.zig
with
11 additions
and
4 deletions
ncdu.pod
+
4
−
0
View file @
46b88bcb
...
...
@@ -252,6 +252,10 @@ 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 B<--enable-natsort>, B<--disable-natsort>
Enable (default) or disable natural sort when sorting by file name.
=item B<--group-directories-first>, B<--no-group-directories-first>
Sort (or not) directories before files.
...
...
This diff is collapsed.
Click to expand it.
src/browser.zig
+
4
−
4
View file @
46b88bcb
...
...
@@ -103,10 +103,10 @@ fn sortLt(_: void, ap: ?*model.Entry, bp: ?*model.Entry) bool {
},
}
const
an
=
a
.
name
();
const
bn
=
b
.
name
();
return
if
(
main
.
config
.
sort_
order
==
.
asc
)
util
.
strnatcmp
(
an
,
bn
)
==
.
lt
else
util
.
strnatcmp
(
b
n
,
a
n
)
==
.
lt
;
const
an
=
(
if
(
main
.
config
.
sort_order
==
.
asc
)
a
else
b
)
.
name
();
const
bn
=
(
if
(
main
.
config
.
sort_order
==
.
asc
)
b
else
a
)
.
name
();
return
if
(
main
.
config
.
sort_
natural
)
util
.
strnatcmp
(
an
,
bn
)
==
.
lt
else
std
.
mem
.
lessThan
(
u8
,
a
n
,
b
n
);
}
// Should be called when:
...
...
This diff is collapsed.
Click to expand it.
src/main.zig
+
3
−
0
View file @
46b88bcb
...
...
@@ -66,6 +66,7 @@ pub const config = struct {
pub
var
sort_col
:
SortCol
=
.
blocks
;
pub
var
sort_order
:
SortOrder
=
.
desc
;
pub
var
sort_dirsfirst
:
bool
=
false
;
pub
var
sort_natural
:
bool
=
true
;
pub
var
imported
:
bool
=
false
;
pub
var
can_delete
:
?
bool
=
null
;
...
...
@@ -183,6 +184,8 @@ fn argConfig(args: *Args, opt: Args.Option) bool {
else
if
(
opt
.
is
(
"--hide-percent"
))
config
.
show_percent
=
false
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
(
"--enable-natsort"
))
config
.
sort_natural
=
true
else
if
(
opt
.
is
(
"--disable-natsort"
))
config
.
sort_natural
=
false
else
if
(
opt
.
is
(
"--graph-style"
))
{
const
val
=
args
.
arg
();
if
(
std
.
mem
.
eql
(
u8
,
val
,
"hash"
))
config
.
graph_style
=
.
hash
...
...
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