Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
后端镜像
rust镜像
Exa
提交
3bce55f5
E
Exa
项目概览
后端镜像
/
rust镜像
/
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,体验更适合开发者的 AI 搜索 >>
提交
3bce55f5
编写于
3月 26, 2017
作者:
B
Benjamin Sago
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Run Untry over the entire source tree
上级
c66a947a
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
33 addition
and
33 deletion
+33
-33
src/exa.rs
src/exa.rs
+10
-10
src/fs/dir.rs
src/fs/dir.rs
+1
-1
src/fs/feature/git.rs
src/fs/feature/git.rs
+2
-2
src/options/dir_action.rs
src/options/dir_action.rs
+2
-2
src/options/filter.rs
src/options/filter.rs
+3
-3
src/options/mod.rs
src/options/mod.rs
+4
-4
src/options/view.rs
src/options/view.rs
+8
-8
src/output/details.rs
src/output/details.rs
+1
-1
src/output/grid.rs
src/output/grid.rs
+1
-1
src/output/lines.rs
src/output/lines.rs
+1
-1
未找到文件。
src/exa.rs
浏览文件 @
3bce55f5
...
...
@@ -72,13 +72,13 @@ impl<'w, W: Write + 'w> Exa<'w, W> {
for
file_name
in
self
.args
.iter
()
{
match
File
::
from_path
(
Path
::
new
(
&
file_name
),
None
)
{
Err
(
e
)
=>
{
try!
(
writeln!
(
stderr
(),
"{}: {}"
,
file_name
,
e
))
;
writeln!
(
stderr
(),
"{}: {}"
,
file_name
,
e
)
?
;
},
Ok
(
f
)
=>
{
if
f
.is_directory
()
&&
!
self
.options.dir_action
.treat_dirs_as_files
()
{
match
f
.to_dir
(
self
.options
.should_scan_for_git
())
{
Ok
(
d
)
=>
dirs
.push
(
d
),
Err
(
e
)
=>
try!
(
writeln!
(
stderr
(),
"{}: {}"
,
file_name
,
e
))
,
Err
(
e
)
=>
writeln!
(
stderr
(),
"{}: {}"
,
file_name
,
e
)
?
,
}
}
else
{
...
...
@@ -96,7 +96,7 @@ impl<'w, W: Write + 'w> Exa<'w, W> {
let
is_only_dir
=
dirs
.len
()
==
1
&&
no_files
;
self
.options.filter
.filter_argument_files
(
&
mut
files
);
try!
(
self
.print_files
(
None
,
files
))
;
self
.print_files
(
None
,
files
)
?
;
self
.print_dirs
(
dirs
,
no_files
,
is_only_dir
)
}
...
...
@@ -110,18 +110,18 @@ impl<'w, W: Write + 'w> Exa<'w, W> {
first
=
false
;
}
else
{
try!
(
write!
(
self
.writer
,
"
\n
"
))
;
write!
(
self
.writer
,
"
\n
"
)
?
;
}
if
!
is_only_dir
{
try!
(
writeln!
(
self
.writer
,
"{}:"
,
dir
.path
.display
()))
;
writeln!
(
self
.writer
,
"{}:"
,
dir
.path
.display
())
?
;
}
let
mut
children
=
Vec
::
new
();
for
file
in
dir
.files
()
{
match
file
{
Ok
(
file
)
=>
children
.push
(
file
),
Err
((
path
,
e
))
=>
try!
(
writeln!
(
stderr
(),
"[{}: {}]"
,
path
.display
(),
e
))
,
Err
((
path
,
e
))
=>
writeln!
(
stderr
(),
"[{}: {}]"
,
path
.display
(),
e
)
?
,
}
};
...
...
@@ -136,17 +136,17 @@ impl<'w, W: Write + 'w> Exa<'w, W> {
for
child_dir
in
children
.iter
()
.filter
(|
f
|
f
.is_directory
())
{
match
child_dir
.to_dir
(
false
)
{
Ok
(
d
)
=>
child_dirs
.push
(
d
),
Err
(
e
)
=>
try!
(
writeln!
(
stderr
(),
"{}: {}"
,
child_dir
.path
.display
(),
e
))
,
Err
(
e
)
=>
writeln!
(
stderr
(),
"{}: {}"
,
child_dir
.path
.display
(),
e
)
?
,
}
}
try!
(
self
.print_files
(
Some
(
&
dir
),
children
))
;
try!
(
self
.print_dirs
(
child_dirs
,
false
,
false
))
;
self
.print_files
(
Some
(
&
dir
),
children
)
?
;
self
.print_dirs
(
child_dirs
,
false
,
false
)
?
;
continue
;
}
}
try!
(
self
.print_files
(
Some
(
&
dir
),
children
))
;
self
.print_files
(
Some
(
&
dir
),
children
)
?
;
}
Ok
(())
...
...
src/fs/dir.rs
浏览文件 @
3bce55f5
...
...
@@ -33,7 +33,7 @@ impl Dir {
/// isn't actually a directory, or if there's an IO error that occurs
/// while scanning.
pub
fn
read_dir
(
path
:
&
Path
,
git
:
bool
)
->
IOResult
<
Dir
>
{
let
reader
=
try!
(
fs
::
read_dir
(
path
))
;
let
reader
=
fs
::
read_dir
(
path
)
?
;
let
contents
=
try!
(
reader
.map
(|
e
|
e
.map
(|
e
|
e
.path
()))
.collect
());
Ok
(
Dir
{
...
...
src/fs/feature/git.rs
浏览文件 @
3bce55f5
...
...
@@ -15,13 +15,13 @@ impl Git {
/// Discover a Git repository on or above this directory, scanning it for
/// the files' statuses if one is found.
pub
fn
scan
(
path
:
&
Path
)
->
Result
<
Git
,
git2
::
Error
>
{
let
repo
=
try!
(
git2
::
Repository
::
discover
(
path
))
;
let
repo
=
git2
::
Repository
::
discover
(
path
)
?
;
let
workdir
=
match
repo
.workdir
()
{
Some
(
w
)
=>
w
,
None
=>
return
Ok
(
Git
{
statuses
:
vec!
[]
}),
// bare repo
};
let
statuses
=
try!
(
repo
.statuses
(
None
))
.iter
()
let
statuses
=
repo
.statuses
(
None
)
?
.iter
()
.map
(|
e
|
(
workdir
.join
(
Path
::
new
(
e
.path
()
.unwrap
())),
e
.status
()))
.collect
();
...
...
src/options/dir_action.rs
浏览文件 @
3bce55f5
...
...
@@ -36,8 +36,8 @@ impl DirAction {
(
true
,
true
,
_
)
=>
Err
(
Misfire
::
Conflict
(
"recurse"
,
"list-dirs"
)),
(
_
,
true
,
true
)
=>
Err
(
Misfire
::
Conflict
(
"tree"
,
"list-dirs"
)),
(
_
,
_
,
true
)
=>
Ok
(
DirAction
::
Recurse
(
try!
(
RecurseOptions
::
deduce
(
matches
,
true
))
)),
(
true
,
false
,
false
)
=>
Ok
(
DirAction
::
Recurse
(
try!
(
RecurseOptions
::
deduce
(
matches
,
false
))
)),
(
_
,
_
,
true
)
=>
Ok
(
DirAction
::
Recurse
(
RecurseOptions
::
deduce
(
matches
,
true
)
?
)),
(
true
,
false
,
false
)
=>
Ok
(
DirAction
::
Recurse
(
RecurseOptions
::
deduce
(
matches
,
false
)
?
)),
(
false
,
true
,
_
)
=>
Ok
(
DirAction
::
AsFile
),
(
false
,
false
,
_
)
=>
Ok
(
DirAction
::
List
),
}
...
...
src/options/filter.rs
浏览文件 @
3bce55f5
...
...
@@ -75,9 +75,9 @@ impl FileFilter {
Ok
(
FileFilter
{
list_dirs_first
:
matches
.opt_present
(
"group-directories-first"
),
reverse
:
matches
.opt_present
(
"reverse"
),
sort_field
:
try!
(
SortField
::
deduce
(
matches
))
,
sort_field
:
SortField
::
deduce
(
matches
)
?
,
show_invisibles
:
matches
.opt_present
(
"all"
),
ignore_patterns
:
try!
(
IgnorePatterns
::
deduce
(
matches
))
,
ignore_patterns
:
IgnorePatterns
::
deduce
(
matches
)
?
,
})
}
...
...
@@ -265,7 +265,7 @@ impl IgnorePatterns {
};
Ok
(
IgnorePatterns
{
patterns
:
try!
(
patterns
)
,
patterns
:
patterns
?
,
})
}
...
...
src/options/mod.rs
浏览文件 @
3bce55f5
...
...
@@ -120,7 +120,7 @@ impl Options {
return
Err
(
Misfire
::
Version
);
}
let
options
=
try!
(
Options
::
deduce
(
&
matches
))
;
let
options
=
Options
::
deduce
(
&
matches
)
?
;
Ok
((
options
,
matches
.free
))
}
...
...
@@ -138,9 +138,9 @@ impl Options {
/// Determines the complete set of options based on the given command-line
/// arguments, after they’ve been parsed.
fn
deduce
(
matches
:
&
getopts
::
Matches
)
->
Result
<
Options
,
Misfire
>
{
let
dir_action
=
try!
(
DirAction
::
deduce
(
&
matches
))
;
let
filter
=
try!
(
FileFilter
::
deduce
(
&
matches
))
;
let
view
=
try!
(
View
::
deduce
(
&
matches
,
filter
.clone
(),
dir_action
))
;
let
dir_action
=
DirAction
::
deduce
(
&
matches
)
?
;
let
filter
=
FileFilter
::
deduce
(
&
matches
)
?
;
let
view
=
View
::
deduce
(
&
matches
,
filter
.clone
(),
dir_action
)
?
;
Ok
(
Options
{
dir_action
:
dir_action
,
...
...
src/options/view.rs
浏览文件 @
3bce55f5
...
...
@@ -37,7 +37,7 @@ impl View {
Err
(
Useless
(
"oneline"
,
true
,
"long"
))
}
else
{
let
term_colours
=
try!
(
TerminalColours
::
deduce
(
matches
))
;
let
term_colours
=
TerminalColours
::
deduce
(
matches
)
?
;
let
colours
=
match
term_colours
{
TerminalColours
::
Always
=>
Colours
::
colourful
(
colour_scale
()),
TerminalColours
::
Never
=>
Colours
::
plain
(),
...
...
@@ -52,7 +52,7 @@ impl View {
};
let
details
=
Details
{
columns
:
Some
(
try!
(
Columns
::
deduce
(
matches
))
),
columns
:
Some
(
Columns
::
deduce
(
matches
)
?
),
header
:
matches
.opt_present
(
"header"
),
recurse
:
dir_action
.recurse_options
(),
filter
:
filter
.clone
(),
...
...
@@ -86,8 +86,8 @@ impl View {
};
let
other_options_scan
=
||
{
let
term_colours
=
try!
(
TerminalColours
::
deduce
(
matches
))
;
let
term_width
=
try!
(
TerminalWidth
::
deduce
())
;
let
term_colours
=
TerminalColours
::
deduce
(
matches
)
?
;
let
term_width
=
TerminalWidth
::
deduce
()
?
;
if
let
Some
(
&
width
)
=
term_width
.as_ref
()
{
let
colours
=
match
term_colours
{
...
...
@@ -164,7 +164,7 @@ impl View {
};
if
matches
.opt_present
(
"long"
)
{
let
long_options
=
try!
(
long
())
;
let
long_options
=
long
()
?
;
if
matches
.opt_present
(
"grid"
)
{
match
other_options_scan
()
{
...
...
@@ -178,7 +178,7 @@ impl View {
}
}
try!
(
long_options_scan
())
;
long_options_scan
()
?
;
other_options_scan
()
}
...
...
@@ -232,8 +232,8 @@ impl TerminalWidth {
impl
Columns
{
fn
deduce
(
matches
:
&
getopts
::
Matches
)
->
Result
<
Columns
,
Misfire
>
{
Ok
(
Columns
{
size_format
:
try!
(
SizeFormat
::
deduce
(
matches
))
,
time_types
:
try!
(
TimeTypes
::
deduce
(
matches
))
,
size_format
:
SizeFormat
::
deduce
(
matches
)
?
,
time_types
:
TimeTypes
::
deduce
(
matches
)
?
,
inode
:
matches
.opt_present
(
"inode"
),
links
:
matches
.opt_present
(
"links"
),
blocks
:
matches
.opt_present
(
"blocks"
),
...
...
src/output/details.rs
浏览文件 @
3bce55f5
...
...
@@ -218,7 +218,7 @@ impl Details {
// Then add files to the table and print it out.
self
.add_files_to_table
(
&
mut
table
,
files
,
0
);
for
cell
in
table
.print_table
()
{
try!
(
writeln!
(
w
,
"{}"
,
cell
.strings
()))
;
writeln!
(
w
,
"{}"
,
cell
.strings
())
?
;
}
Ok
(())
...
...
src/output/grid.rs
浏览文件 @
3bce55f5
...
...
@@ -48,7 +48,7 @@ impl Grid {
else
{
// File names too long for a grid - drop down to just listing them!
for
file
in
files
.iter
()
{
try!
(
writeln!
(
w
,
"{}"
,
filename
(
file
,
&
self
.colours
,
false
)
.strings
()))
;
writeln!
(
w
,
"{}"
,
filename
(
file
,
&
self
.colours
,
false
)
.strings
())
?
;
}
Ok
(())
}
...
...
src/output/lines.rs
浏览文件 @
3bce55f5
...
...
@@ -17,7 +17,7 @@ pub struct Lines {
impl
Lines
{
pub
fn
view
<
W
:
Write
>
(
&
self
,
files
:
Vec
<
File
>
,
w
:
&
mut
W
)
->
IOResult
<
()
>
{
for
file
in
files
{
try!
(
writeln!
(
w
,
"{}"
,
ANSIStrings
(
&
filename
(
&
file
,
&
self
.colours
,
true
))))
;
writeln!
(
w
,
"{}"
,
ANSIStrings
(
&
filename
(
&
file
,
&
self
.colours
,
true
)))
?
;
}
Ok
(())
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录