From 3e4299e263323d3aad462158e7712f64571a7fbd Mon Sep 17 00:00:00 2001 From: hengyunabc Date: Tue, 29 Oct 2019 23:43:06 +0800 Subject: [PATCH] add grep command doc. #899 --- .../core/command/basic1000/GrepCommand.java | 2 +- site/src/site/sphinx/advanced-use.md | 1 + site/src/site/sphinx/commands.md | 1 + site/src/site/sphinx/en/advanced-use.md | 1 + site/src/site/sphinx/en/commands.md | 1 + site/src/site/sphinx/en/grep.md | 37 +++++++++++++++++++ site/src/site/sphinx/grep.md | 37 +++++++++++++++++++ 7 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 site/src/site/sphinx/en/grep.md create mode 100644 site/src/site/sphinx/grep.md diff --git a/core/src/main/java/com/taobao/arthas/core/command/basic1000/GrepCommand.java b/core/src/main/java/com/taobao/arthas/core/command/basic1000/GrepCommand.java index 5eec534b6..83c31b4d4 100644 --- a/core/src/main/java/com/taobao/arthas/core/command/basic1000/GrepCommand.java +++ b/core/src/main/java/com/taobao/arthas/core/command/basic1000/GrepCommand.java @@ -14,7 +14,7 @@ import com.taobao.middleware.cli.annotations.Summary; * @see com.taobao.arthas.core.shell.command.internal.GrepHandler */ @Name("grep") -@Summary("grep command for pipes.\n" ) +@Summary("grep command for pipes." ) @Description(Constants.EXAMPLE + " sysprop | grep java \n" + " sysprop | grep java -n\n" + diff --git a/site/src/site/sphinx/advanced-use.md b/site/src/site/sphinx/advanced-use.md index 06ec1b774..b79ee359a 100644 --- a/site/src/site/sphinx/advanced-use.md +++ b/site/src/site/sphinx/advanced-use.md @@ -6,6 +6,7 @@ * help——查看命令帮助信息 * [cat](cat.md)——打印文件内容,和linux里的cat命令类似 +* [grep]](grep.md)——匹配查找,和linux里的grep命令类似 * [pwd](pwd.md)——返回当前的工作目录,和linux命令类似 * cls——清空当前屏幕区域 * session——查看当前会话的信息 diff --git a/site/src/site/sphinx/commands.md b/site/src/site/sphinx/commands.md index bc5981df9..918b451a5 100644 --- a/site/src/site/sphinx/commands.md +++ b/site/src/site/sphinx/commands.md @@ -30,6 +30,7 @@ * [tt](tt.md) * [cat](cat.md) +* [grep](grep.md) * [pwd](pwd.md) * [options](options.md) diff --git a/site/src/site/sphinx/en/advanced-use.md b/site/src/site/sphinx/en/advanced-use.md index 94ebae613..5c6d403da 100644 --- a/site/src/site/sphinx/en/advanced-use.md +++ b/site/src/site/sphinx/en/advanced-use.md @@ -6,6 +6,7 @@ Advanced Usage * help - display Arthas help * cls - clear the screen * [cat](cat.md) - Concatenate and print files +* [grep]](grep.md) - Pattern searcher * [pwd](pwd.md) - Return working directory name * session - display current session information * [reset](reset.md) - reset all the enhanced classes. All enhanced classes will also be reset when Arthas server is closed by `shutdown` diff --git a/site/src/site/sphinx/en/commands.md b/site/src/site/sphinx/en/commands.md index c7aedf0c3..7ad6d23f8 100644 --- a/site/src/site/sphinx/en/commands.md +++ b/site/src/site/sphinx/en/commands.md @@ -30,6 +30,7 @@ All Commands * [tt](tt.md) * [cat](cat.md) +* [grep](grep.md) * [pwd](pwd.md) * [options](options.md) diff --git a/site/src/site/sphinx/en/grep.md b/site/src/site/sphinx/en/grep.md new file mode 100644 index 000000000..f2b6994a2 --- /dev/null +++ b/site/src/site/sphinx/en/grep.md @@ -0,0 +1,37 @@ +Grep +=== + +> Similar to the traditional `grep` command. + + +``` + USAGE: + grep [-A ] [-B ] [-C ] [-h] [-i] [-v] [-n] [-m ] [-e] [--trim-end] pattern + + SUMMARY: + grep command for pipes. + + EXAMPLES: + sysprop | grep java + sysprop | grep java -n + sysenv | grep -v JAVA + sysenv | grep -e "(?i)(JAVA|sun)" -m 3 -C 2 + sysenv | grep JAVA -A2 -B3 + thread | grep -m 10 -e "TIMED_WAITING|WAITING" + + WIKI: + https://alibaba.github.io/arthas/grep + + OPTIONS: + -A, --after-context Print NUM lines of trailing context) + -B, --before-context Print NUM lines of leading context) + -C, --context Print NUM lines of output context) + -h, --help this help + -i, --ignore-case Perform case insensitive matching. By default, grep is case sensitive. + -v, --invert-match Select non-matching lines + -n, --line-number Print line number with output lines + -m, --max-count stop after NUM selected lines) + -e, --regex Enable regular expression to match + --trim-end Remove whitespaces at the end of the line + Pattern +``` \ No newline at end of file diff --git a/site/src/site/sphinx/grep.md b/site/src/site/sphinx/grep.md new file mode 100644 index 000000000..6e709d10b --- /dev/null +++ b/site/src/site/sphinx/grep.md @@ -0,0 +1,37 @@ +Grep +=== + +> 类似传统的`grep`命令。 + + +``` + USAGE: + grep [-A ] [-B ] [-C ] [-h] [-i] [-v] [-n] [-m ] [-e] [--trim-end] pattern + + SUMMARY: + grep command for pipes. + + EXAMPLES: + sysprop | grep java + sysprop | grep java -n + sysenv | grep -v JAVA + sysenv | grep -e "(?i)(JAVA|sun)" -m 3 -C 2 + sysenv | grep JAVA -A2 -B3 + thread | grep -m 10 -e "TIMED_WAITING|WAITING" + + WIKI: + https://alibaba.github.io/arthas/grep + + OPTIONS: + -A, --after-context Print NUM lines of trailing context) + -B, --before-context Print NUM lines of leading context) + -C, --context Print NUM lines of output context) + -h, --help this help + -i, --ignore-case Perform case insensitive matching. By default, grep is case sensitive. + -v, --invert-match Select non-matching lines + -n, --line-number Print line number with output lines + -m, --max-count stop after NUM selected lines) + -e, --regex Enable regular expression to match + --trim-end Remove whitespaces at the end of the line + Pattern +``` \ No newline at end of file