Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
后端镜像
rust镜像
Ripgrep
提交
fc975af8
R
Ripgrep
项目概览
后端镜像
/
rust镜像
/
Ripgrep
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Ripgrep
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
fc975af8
编写于
3月 31, 2017
作者:
A
Andrew Gallant
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Enforce 79 column limit. Grr.
上级
1425d673
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
15 addition
and
14 deletion
+15
-14
src/app.rs
src/app.rs
+6
-5
src/args.rs
src/args.rs
+1
-1
src/decoder.rs
src/decoder.rs
+2
-1
src/printer.rs
src/printer.rs
+4
-5
src/search_buffer.rs
src/search_buffer.rs
+2
-2
未找到文件。
src/app.rs
浏览文件 @
fc975af8
...
...
@@ -388,10 +388,11 @@ lazy_static! {
"Limit the number of matching lines per file searched to NUM."
);
doc!
(
h
,
"max-filesize"
,
"Ignore files larger than NUM in size."
,
"Ignore files larger than NUM in size. Does not ignore directories.
\
"Ignore files larger than NUM in size. Does not ignore
\
directories.
\
\n\n
The input format accepts suffixes of K, M or G which
\
correspond to kilobytes, megabytes and gigabytes. If no suffix
is
\
provided the input is treated as bytes.
\
correspond to kilobytes, megabytes and gigabytes. If no suffix
\
is
provided the input is treated as bytes.
\
\n\n
Example: --max-filesize 50K or --max-filesize 80M"
);
doc!
(
h
,
"maxdepth"
,
"Descend at most NUM directories."
,
...
...
@@ -496,8 +497,8 @@ lazy_static! {
permits specifying one or more other type names (separated by a
\
comma) that have been defined and its rules will automatically
\
be imported into the type specified. For example, to create a
\
type called src that matches C++, Python and Markdown files,
one
\
can use:
\n\n
\
type called src that matches C++, Python and Markdown files,
\
one
can use:
\n\n
\
--type-add 'src:include:cpp,py,md'
\n\n
\
Additional glob rules can still be added to the src type by
\
using the --type-add flag again:
\n\n
\
...
...
src/args.rs
浏览文件 @
fc975af8
...
...
@@ -837,7 +837,7 @@ impl<'a> ArgMatches<'a> {
let
caps
=
try!
(
re
.captures
(
&
max_filesize
)
.ok_or
(
"invalid format for max-filesize argument"
));
let
value
=
try!
(
caps
[
1
]
.parse
::
<
u64
>
()
.map_err
(|
err
|
err
.to_string
()));
let
value
=
try!
(
caps
[
1
]
.parse
::
<
u64
>
()
.map_err
(|
err
|
err
.to_string
()));
let
suffix
=
caps
.get
(
2
)
.map
(|
x
|
x
.as_str
());
match
suffix
{
...
...
src/decoder.rs
浏览文件 @
fc975af8
...
...
@@ -447,7 +447,8 @@ mod tests {
test_trans_simple!
(
trans_simple_utf16be
,
"utf-16be"
,
b
"
\x04\x16
"
,
"Ж"
);
test_trans_simple!
(
trans_simple_chinese
,
"chinese"
,
b
"
\xA7\xA8
"
,
"Ж"
);
test_trans_simple!
(
trans_simple_korean
,
"korean"
,
b
"
\xAC\xA8
"
,
"Ж"
);
test_trans_simple!
(
trans_simple_big5_hkscs
,
"big5-hkscs"
,
b
"
\xC7\xFA
"
,
"Ж"
);
test_trans_simple!
(
trans_simple_big5_hkscs
,
"big5-hkscs"
,
b
"
\xC7\xFA
"
,
"Ж"
);
test_trans_simple!
(
trans_simple_gbk
,
"gbk"
,
b
"
\xA7\xA8
"
,
"Ж"
);
test_trans_simple!
(
trans_simple_sjis
,
"sjis"
,
b
"
\x84\x47
"
,
"Ж"
);
test_trans_simple!
(
trans_simple_eucjp
,
"euc-jp"
,
b
"
\xA7\xA8
"
,
"Ж"
);
...
...
src/printer.rs
浏览文件 @
fc975af8
...
...
@@ -153,9 +153,6 @@ impl<W: WriteColor> Printer<W> {
/// Replace every match in each matching line with the replacement string
/// given.
///
/// The replacement string syntax is documented here:
/// https://doc.rust-lang.org/regex/regex/bytes/struct.Captures.html#method.expand
pub
fn
replace
(
mut
self
,
replacement
:
Vec
<
u8
>
)
->
Printer
<
W
>
{
self
.replace
=
Some
(
replacement
);
self
...
...
@@ -290,7 +287,8 @@ impl<W: WriteColor> Printer<W> {
re
.replace_all
(
&
buf
[
start
..
end
],
replacer
)
};
if
self
.max_columns
.map_or
(
false
,
|
m
|
line
.len
()
>
m
)
{
let
msg
=
format!
(
"[Omitted long line with {} replacements]"
,
count
);
let
msg
=
format!
(
"[Omitted long line with {} replacements]"
,
count
);
self
.write_colored
(
msg
.as_bytes
(),
|
colors
|
colors
.matched
());
self
.write_eol
();
return
;
...
...
@@ -319,7 +317,8 @@ impl<W: WriteColor> Printer<W> {
let
mut
last_written
=
0
;
for
m
in
re
.find_iter
(
buf
)
{
self
.write
(
&
buf
[
last_written
..
m
.start
()]);
self
.write_colored
(
&
buf
[
m
.start
()
..
m
.end
()],
|
colors
|
colors
.matched
());
self
.write_colored
(
&
buf
[
m
.start
()
..
m
.end
()],
|
colors
|
colors
.matched
());
last_written
=
m
.end
();
}
self
.write
(
&
buf
[
last_written
..
]);
...
...
src/search_buffer.rs
浏览文件 @
fc975af8
...
...
@@ -3,8 +3,8 @@ The `search_buffer` module is responsible for searching a single file all in a
single buffer. Typically, the source of the buffer is a memory map. This can
be useful for when memory maps are faster than streaming search.
Note that this module doesn't quite support everything that `search_stream`
does.
Notably, showing contexts.
Note that this module doesn't quite support everything that `search_stream`
Not
does.
ably, showing contexts.
*/
use
std
::
cmp
;
use
std
::
path
::
Path
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录