Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
vnotepad
Exa
提交
22b593d1
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,发现更多精彩内容 >>
提交
22b593d1
编写于
4月 02, 2017
作者:
B
Benjamin Sago
提交者:
GitHub
4月 02, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' into update-deps
上级
2b2e973c
f1be6b89
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
28 addition
and
13 deletion
+28
-13
Cargo.lock
Cargo.lock
+5
-0
Vagrantfile
Vagrantfile
+1
-1
src/bin/main.rs
src/bin/main.rs
+12
-7
src/exa.rs
src/exa.rs
+10
-5
未找到文件。
Cargo.lock
浏览文件 @
22b593d1
...
...
@@ -30,6 +30,11 @@ name = "bitflags"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "bitflags"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "byteorder"
version = "0.4.2"
...
...
Vagrantfile
浏览文件 @
22b593d1
...
...
@@ -9,7 +9,7 @@ Vagrant.configure("2") do |config|
# Install the dependencies needed for exa to build.
config
.
vm
.
provision
:shell
,
privileged:
true
,
inline:
%[apt-get install -y git cmake libgit2-dev libssh2-1-dev curl attr]
%[apt-get install -y git cmake libgit2-dev libssh2-1-dev curl attr
pkg-config
]
# Guarantee that the timezone is UTC -- some of the tests
# depend on this (for now).
...
...
src/bin/main.rs
浏览文件 @
22b593d1
...
...
@@ -10,7 +10,10 @@ fn main() {
let
mut
stdout
=
stdout
();
match
Exa
::
new
(
&
args
,
&
mut
stdout
)
{
Ok
(
mut
exa
)
=>
if
let
Err
(
e
)
=
exa
.run
()
{
Ok
(
mut
exa
)
=>
{
match
exa
.run
()
{
Ok
(
exit_status
)
=>
exit
(
exit_status
),
Err
(
e
)
=>
{
match
e
.kind
()
{
ErrorKind
::
BrokenPipe
=>
exit
(
0
),
_
=>
{
...
...
@@ -18,6 +21,8 @@ fn main() {
exit
(
1
);
},
};
}
};
},
Err
(
e
)
=>
{
writeln!
(
stderr
(),
"{}"
,
e
)
.unwrap
();
...
...
src/exa.rs
浏览文件 @
22b593d1
...
...
@@ -60,9 +60,10 @@ impl<'w, W: Write + 'w> Exa<'w, W> {
})
}
pub
fn
run
(
&
mut
self
)
->
IOResult
<
()
>
{
pub
fn
run
(
&
mut
self
)
->
IOResult
<
i32
>
{
let
mut
files
=
Vec
::
new
();
let
mut
dirs
=
Vec
::
new
();
let
mut
exit_status
=
0
;
// List the current directory by default, like ls.
if
self
.args
.is_empty
()
{
...
...
@@ -72,6 +73,7 @@ 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
)
=>
{
exit_status
=
2
;
writeln!
(
stderr
(),
"{}: {}"
,
file_name
,
e
)
?
;
},
Ok
(
f
)
=>
{
...
...
@@ -98,10 +100,10 @@ impl<'w, W: Write + 'w> Exa<'w, W> {
self
.options.filter
.filter_argument_files
(
&
mut
files
);
self
.print_files
(
None
,
files
)
?
;
self
.print_dirs
(
dirs
,
no_files
,
is_only_dir
)
self
.print_dirs
(
dirs
,
no_files
,
is_only_dir
,
exit_status
)
}
fn
print_dirs
(
&
mut
self
,
dir_files
:
Vec
<
Dir
>
,
mut
first
:
bool
,
is_only_dir
:
bool
)
->
IOResult
<
()
>
{
fn
print_dirs
(
&
mut
self
,
dir_files
:
Vec
<
Dir
>
,
mut
first
:
bool
,
is_only_dir
:
bool
,
exit_status
:
i32
)
->
IOResult
<
i32
>
{
for
dir
in
dir_files
{
// Put a gap between directories, or between the list of files and
...
...
@@ -141,7 +143,10 @@ impl<'w, W: Write + 'w> Exa<'w, W> {
}
self
.print_files
(
Some
(
&
dir
),
children
)
?
;
self
.print_dirs
(
child_dirs
,
false
,
false
)
?
;
match
self
.print_dirs
(
child_dirs
,
false
,
false
,
exit_status
)
{
Ok
(
_
)
=>
(),
Err
(
e
)
=>
return
Err
(
e
),
}
continue
;
}
}
...
...
@@ -149,7 +154,7 @@ impl<'w, W: Write + 'w> Exa<'w, W> {
self
.print_files
(
Some
(
&
dir
),
children
)
?
;
}
Ok
(
()
)
Ok
(
exit_status
)
}
/// Prints the list of files using whichever view is selected.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录