Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
vnotepad
Exa
提交
5b7124bb
E
Exa
项目概览
vnotepad
/
Exa
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
Exa
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
5b7124bb
编写于
11月 24, 2014
作者:
B
Ben S
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
I like aligning things
上级
d72be30c
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
22 addition
and
27 deletion
+22
-27
src/column.rs
src/column.rs
+7
-7
src/dir.rs
src/dir.rs
+2
-6
src/options.rs
src/options.rs
+9
-8
src/sort.rs
src/sort.rs
+1
-1
src/term.rs
src/term.rs
+2
-4
src/unix.rs
src/unix.rs
+1
-1
未找到文件。
src/column.rs
浏览文件 @
5b7124bb
...
...
@@ -30,13 +30,13 @@ impl Column {
pub
fn
header
(
&
self
)
->
&
'static
str
{
match
*
self
{
Column
::
Permissions
=>
"Permissions"
,
Column
::
FileName
=>
"Name"
,
Column
::
FileName
=>
"Name"
,
Column
::
FileSize
(
_
)
=>
"Size"
,
Column
::
Blocks
=>
"Blocks"
,
Column
::
User
=>
"User"
,
Column
::
Group
=>
"Group"
,
Column
::
HardLinks
=>
"Links"
,
Column
::
Inode
=>
"inode"
,
Column
::
Blocks
=>
"Blocks"
,
Column
::
User
=>
"User"
,
Column
::
Group
=>
"Group"
,
Column
::
HardLinks
=>
"Links"
,
Column
::
Inode
=>
"inode"
,
}
}
}
...
...
@@ -49,7 +49,7 @@ impl Column {
impl
Alignment
{
pub
fn
pad_string
(
&
self
,
string
:
&
String
,
padding
:
uint
)
->
String
{
match
*
self
{
Alignment
::
Left
=>
string
.clone
()
+
" "
.repeat
(
padding
)
.as_slice
(),
Alignment
::
Left
=>
string
.clone
()
+
" "
.repeat
(
padding
)
.as_slice
(),
Alignment
::
Right
=>
" "
.repeat
(
padding
)
+
string
.as_slice
(),
}
}
...
...
src/dir.rs
浏览文件 @
5b7124bb
...
...
@@ -25,12 +25,8 @@ impl<'a> Dir<'a> {
for
path
in
self
.contents
.iter
()
{
match
File
::
from_path
(
path
,
self
)
{
Ok
(
file
)
=>
{
files
.push
(
file
);
}
Err
(
e
)
=>
{
println!
(
"{}: {}"
,
path
.display
(),
e
);
}
Ok
(
file
)
=>
files
.push
(
file
),
Err
(
e
)
=>
println!
(
"{}: {}"
,
path
.display
(),
e
),
}
}
...
...
src/options.rs
浏览文件 @
5b7124bb
...
...
@@ -52,7 +52,7 @@ impl Options {
getopts
::
optflag
(
"l"
,
"long"
,
"display extended details and attributes"
),
getopts
::
optflag
(
"i"
,
"inode"
,
"show each file's inode number"
),
getopts
::
optflag
(
"r"
,
"reverse"
,
"reverse order of files"
),
getopts
::
optopt
(
"s"
,
"sort"
,
"field to sort by"
,
"WORD"
),
getopts
::
optopt
(
"s"
,
"sort"
,
"field to sort by"
,
"WORD"
),
getopts
::
optflag
(
"S"
,
"blocks"
,
"show number of file system blocks"
),
getopts
::
optflag
(
"x"
,
"across"
,
"sort multi-column view entries across"
),
];
...
...
@@ -61,11 +61,11 @@ impl Options {
Err
(
f
)
=>
Err
(
f
),
Ok
(
ref
matches
)
=>
Ok
(
Options
{
show_invisibles
:
matches
.opt_present
(
"all"
),
reverse
:
matches
.opt_present
(
"reverse"
),
header
:
matches
.opt_present
(
"header"
),
sort_field
:
matches
.opt_str
(
"sort"
)
.map
(|
word
|
SortField
::
from_word
(
word
))
.unwrap_or
(
SortField
::
Name
),
dirs
:
if
matches
.free
.is_empty
()
{
vec!
[
"."
.to_string
()
]
}
else
{
matches
.free
.clone
()
},
view
:
Options
::
view
(
matches
),
reverse
:
matches
.opt_present
(
"reverse"
),
header
:
matches
.opt_present
(
"header"
),
sort_field
:
matches
.opt_str
(
"sort"
)
.map
(|
word
|
SortField
::
from_word
(
word
))
.unwrap_or
(
SortField
::
Name
),
dirs
:
if
matches
.free
.is_empty
()
{
vec!
[
"."
.to_string
()
]
}
else
{
matches
.free
.clone
()
},
view
:
Options
::
view
(
matches
),
})
}
}
...
...
@@ -118,7 +118,8 @@ impl Options {
fn
should_display
(
&
self
,
f
:
&
File
)
->
bool
{
if
self
.show_invisibles
{
true
}
else
{
}
else
{
!
f
.name
.as_slice
()
.starts_with
(
"."
)
}
}
...
...
@@ -134,7 +135,7 @@ impl Options {
SortField
::
Size
=>
files
.sort_by
(|
a
,
b
|
a
.stat.size
.cmp
(
&
b
.stat.size
)),
SortField
::
FileInode
=>
files
.sort_by
(|
a
,
b
|
a
.stat.unstable.inode
.cmp
(
&
b
.stat.unstable.inode
)),
SortField
::
Extension
=>
files
.sort_by
(|
a
,
b
|
{
let
exts
=
a
.ext
.clone
()
.map
(|
e
|
e
.to_ascii_lower
())
.cmp
(
&
b
.ext
.clone
()
.map
(|
e
|
e
.to_ascii_lower
()));
let
exts
=
a
.ext
.clone
()
.map
(|
e
|
e
.to_ascii_lower
())
.cmp
(
&
b
.ext
.clone
()
.map
(|
e
|
e
.to_ascii_lower
()));
let
names
=
a
.name
.to_ascii_lower
()
.cmp
(
&
b
.name
.to_ascii_lower
());
exts
.cmp
(
&
names
)
}),
...
...
src/sort.rs
浏览文件 @
5b7124bb
...
...
@@ -22,7 +22,7 @@ impl SortPart {
// numbers too big for a u64 fall back into strings.
match
from_str
::
<
u64
>
(
slice
)
{
Some
(
num
)
=>
SortPart
::
Numeric
(
num
),
None
=>
SortPart
::
Stringular
(
slice
.to_string
()),
None
=>
SortPart
::
Stringular
(
slice
.to_string
()),
}
}
else
{
SortPart
::
Stringular
(
slice
.to_ascii_lower
())
...
...
src/term.rs
浏览文件 @
5b7124bb
mod
c
{
#![allow(non_camel_case_types)]
extern
crate
libc
;
...
...
@@ -21,11 +20,10 @@ mod c {
// Unfortunately the actual command is not standardised...
#[cfg(any(target_os
=
"linux"
,
target_os
=
"android"
))]
#[cfg(any(target_os
=
"linux"
,
target_os
=
"android"
))]
static
TIOCGWINSZ
:
c_ulong
=
0x5413
;
#[cfg(any(target_os
=
"macos"
,
target_os
=
"ios"
))]
#[cfg(any(target_os
=
"macos"
,
target_os
=
"ios"
))]
static
TIOCGWINSZ
:
c_ulong
=
0x40087468
;
extern
{
...
...
src/unix.rs
浏览文件 @
5b7124bb
...
...
@@ -116,7 +116,7 @@ impl Unix {
if
username
==
ptr
::
null
()
{
return
false
;
}
if
unsafe
{
from_buf
(
username
as
*
const
u8
)
}
==
*
uname
{
else
if
unsafe
{
from_buf
(
username
as
*
const
u8
)
}
==
*
uname
{
return
true
;
}
else
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录