Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
vnotepad
Exa
提交
cc1d6aa5
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,发现更多精彩内容 >>
提交
cc1d6aa5
编写于
6月 04, 2015
作者:
B
Ben S
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Display dates with the host's timezone
Fixes #54 using the datetime crate's spiffy new time zone ability.
上级
90c77ff3
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
53 addition
and
26 deletion
+53
-26
Cargo.lock
Cargo.lock
+45
-23
Cargo.toml
Cargo.toml
+1
-1
src/output/details.rs
src/output/details.rs
+7
-2
未找到文件。
Cargo.lock
浏览文件 @
cc1d6aa5
...
...
@@ -2,15 +2,15 @@
name = "exa"
version = "0.2.0"
dependencies = [
"ansi_term 0.5.2",
"ansi_term 0.5.2
(registry+https://github.com/rust-lang/crates.io-index)
",
"bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"datetime 0.
1.7 (registry+https://github.com/rust-lang/crates.io-index)
",
"datetime 0.
2.0
",
"getopts 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"git2 0.2.11 (git+https://github.com/alexcrichton/git2-rs.git)",
"libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"locale 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"natord 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 0.2.
5
(registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 0.2.
6
(registry+https://github.com/rust-lang/crates.io-index)",
"number_prefix 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"pad 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-width 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
...
...
@@ -20,6 +20,7 @@ dependencies = [
[[package]]
name = "ansi_term"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "bitflags"
...
...
@@ -27,20 +28,25 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "
datetime
"
version = "0.
1.7
"
name = "
byteorder
"
version = "0.
3.10
"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "datetime"
version = "0.2.0"
dependencies = [
"locale 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"num 0.1.2
4
(registry+https://github.com/rust-lang/crates.io-index)",
"num 0.1.2
5
(registry+https://github.com/rust-lang/crates.io-index)",
"pad 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)",
"regex_macros 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 0.1.33 (registry+https://github.com/rust-lang/crates.io-index)",
"regex_macros 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)",
"tz 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "gcc"
version = "0.3.
5
"
version = "0.3.
6
"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
...
...
@@ -54,12 +60,12 @@ dependencies = [
[[package]]
name = "git2"
version = "0.2.11"
source = "git+https://github.com/alexcrichton/git2-rs.git#
49c7a7b3853626180e1767051ed53f0400140ff2
"
source = "git+https://github.com/alexcrichton/git2-rs.git#
f63542fb5d58c138dd3ec32f78ab3f97e2251cfa
"
dependencies = [
"bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"libgit2-sys 0.2.14 (git+https://github.com/alexcrichton/git2-rs.git)",
"url 0.2.3
4
(registry+https://github.com/rust-lang/crates.io-index)",
"url 0.2.3
5
(registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
...
...
@@ -70,10 +76,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "libgit2-sys"
version = "0.2.14"
source = "git+https://github.com/alexcrichton/git2-rs.git#
49c7a7b3853626180e1767051ed53f0400140ff2
"
source = "git+https://github.com/alexcrichton/git2-rs.git#
f63542fb5d58c138dd3ec32f78ab3f97e2251cfa
"
dependencies = [
"libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"libssh2-sys 0.1.2
3
(registry+https://github.com/rust-lang/crates.io-index)",
"libssh2-sys 0.1.2
5
(registry+https://github.com/rust-lang/crates.io-index)",
"libz-sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"openssl-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
...
...
@@ -89,7 +95,7 @@ dependencies = [
[[package]]
name = "libssh2-sys"
version = "0.1.2
3
"
version = "0.1.2
5
"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
...
...
@@ -113,7 +119,7 @@ version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"num 0.1.2
4
(registry+https://github.com/rust-lang/crates.io-index)",
"num 0.1.2
5
(registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
...
...
@@ -136,7 +142,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "num"
version = "0.1.2
4
"
version = "0.1.2
5
"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"rand 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
...
...
@@ -145,7 +151,7 @@ dependencies = [
[[package]]
name = "num_cpus"
version = "0.2.
5
"
version = "0.2.
6
"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
...
...
@@ -156,7 +162,7 @@ name = "number_prefix"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"num 0.1.2
4
(registry+https://github.com/rust-lang/crates.io-index)",
"num 0.1.2
5
(registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
...
...
@@ -164,7 +170,7 @@ name = "openssl-sys"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"gcc 0.3.
5
(registry+https://github.com/rust-lang/crates.io-index)",
"gcc 0.3.
6
(registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"libressl-pnacl-sys 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
...
...
@@ -201,15 +207,23 @@ dependencies = [
[[package]]
name = "regex"
version = "0.1.30"
version = "0.1.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"regex-syntax 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "regex-syntax"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "regex_macros"
version = "0.1.1
7
"
version = "0.1.1
9
"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"regex 0.1.3
0
(registry+https://github.com/rust-lang/crates.io-index)",
"regex 0.1.3
3
(registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
...
...
@@ -225,6 +239,14 @@ dependencies = [
"rand 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "tz"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"byteorder 0.3.10 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "unicode-width"
version = "0.1.1"
...
...
@@ -232,7 +254,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "url"
version = "0.2.3
4
"
version = "0.2.3
5
"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
...
...
Cargo.toml
浏览文件 @
cc1d6aa5
...
...
@@ -9,7 +9,7 @@ name = "exa"
[dependencies]
ansi_term
=
"0.5.0"
bitflags
=
"0.1"
datetime
=
"0.
1.3
"
datetime
=
"0.
2.0
"
getopts
=
"0.2.1"
libc
=
"*"
locale
=
"0.1.2"
...
...
src/output/details.rs
浏览文件 @
cc1d6aa5
...
...
@@ -19,6 +19,8 @@ use number_prefix::{binary_prefix, decimal_prefix, Prefixed, Standalone, PrefixN
use
datetime
::
local
::{
LocalDateTime
,
DatePiece
};
use
datetime
::
format
::{
DateFormat
};
use
datetime
::
zoned
::{
VariableOffset
,
TimeZone
};
/// With the **Details** view, the output gets formatted into columns, with
/// each `Column` object showing some piece of information about the file,
...
...
@@ -128,6 +130,7 @@ pub struct Table<U> {
time
:
locale
::
Time
,
numeric
:
locale
::
Numeric
,
tz
:
VariableOffset
,
users
:
U
,
colours
:
Colours
,
current_year
:
i64
,
...
...
@@ -140,6 +143,7 @@ impl Default for Table<MockUsers> {
rows
:
Vec
::
new
(),
time
:
locale
::
Time
::
english
(),
numeric
:
locale
::
Numeric
::
english
(),
tz
:
VariableOffset
::
localtime
()
.unwrap
(),
users
:
MockUsers
::
with_current_uid
(
0
),
colours
:
Colours
::
default
(),
current_year
:
1234
,
...
...
@@ -158,6 +162,7 @@ impl Table<OSUsers> {
time
:
locale
::
Time
::
load_user_locale
()
.unwrap_or_else
(|
_
|
locale
::
Time
::
english
()),
numeric
:
locale
::
Numeric
::
load_user_locale
()
.unwrap_or_else
(|
_
|
locale
::
Numeric
::
english
()),
tz
:
VariableOffset
::
localtime
()
.unwrap
(),
users
:
OSUsers
::
empty_cache
(),
colours
:
colours
,
current_year
:
LocalDateTime
::
now
()
.year
(),
...
...
@@ -304,7 +309,7 @@ impl<U> Table<U> where U: Users {
}
fn
render_time
(
&
self
,
timestamp
:
f
::
Time
)
->
Cell
{
let
date
=
LocalDateTime
::
at
(
timestamp
.0
);
let
date
=
self
.tz
.at
(
LocalDateTime
::
at
(
timestamp
.0
)
);
let
format
=
if
date
.year
()
==
self
.current_year
{
DateFormat
::
parse
(
"{2>:D} {:M} {2>:h}:{02>:m}"
)
.unwrap
()
...
...
@@ -313,7 +318,7 @@ impl<U> Table<U> where U: Users {
DateFormat
::
parse
(
"{2>:D} {:M} {5>:Y}"
)
.unwrap
()
};
Cell
::
paint
(
self
.colours.date
,
&
format
.format
(
date
,
&
self
.time
))
Cell
::
paint
(
self
.colours.date
,
&
format
.format
(
&
date
,
&
self
.time
))
}
fn
render_git_status
(
&
self
,
git
:
f
::
Git
)
->
Cell
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录