diff --git a/CHANGES.md b/CHANGES.md
index b1413c29a5..dbfa3f20a6 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -26,6 +26,7 @@ Core Grammars:
- enh(json) add json5 support [Kerry Shetline][]
- fix(css) `unicode-range` parsing, issue #4253 [Kerry Shetline][]
- fix(csharp) Support digit separators [te-ing][]
+- fix(bash) arguments highlight for Bash/Shell, issue #4288 [tuyen-at-work][]
Documentation:
@@ -55,6 +56,7 @@ CONTRIBUTORS
[te-ing]: https://github.com/te-ing
[Anthony Martin]: https://github.com/anthony-c-martin
[NriotHrreion]: https://github.com/NriotHrreion
+[tuyen-at-work]: https://github.com/tuyen-at-work
## Version 11.11.1
diff --git a/src/languages/bash.js b/src/languages/bash.js
index 44f9beba97..68b6758980 100644
--- a/src/languages/bash.js
+++ b/src/languages/bash.js
@@ -117,6 +117,16 @@ export default function(hljs) {
relevance: 0
};
+ const BASH_ARGUMENTS = {
+ variants: [
+ {
+ className: "attr",
+ begin: /[\t\u0020](-){1,2}[\w\d-]+/,
+ relevance: 0,
+ },
+ ],
+ };
+
const KEYWORDS = [
"if",
"then",
@@ -392,6 +402,7 @@ export default function(hljs) {
contains: [
KNOWN_SHEBANG, // to catch known shells and boost relevancy
hljs.SHEBANG(), // to catch unknown shells but still highlight the shebang
+ BASH_ARGUMENTS,
FUNCTION,
ARITHMETIC,
COMMENT,
diff --git a/test/markup/bash/escaped-quote.expect.txt b/test/markup/bash/escaped-quote.expect.txt
index 3d7f2432ae..7222cd2307 100644
--- a/test/markup/bash/escaped-quote.expect.txt
+++ b/test/markup/bash/escaped-quote.expect.txt
@@ -1,2 +1,2 @@
-echo '"quoted"' | tr -d \" > text.txt
+echo '"quoted"' | tr -d \" > text.txt
diff --git a/test/markup/bash/no-numbers.expect.txt b/test/markup/bash/no-numbers.expect.txt
index 258f5d74b7..b6dc363e0a 100644
--- a/test/markup/bash/no-numbers.expect.txt
+++ b/test/markup/bash/no-numbers.expect.txt
@@ -1,3 +1,3 @@
-$ tail -10 access.log
+$ tail -10 access.log
diff --git a/test/markup/bash/strings.expect.txt b/test/markup/bash/strings.expect.txt
index b86c42b509..535c2593b7 100644
--- a/test/markup/bash/strings.expect.txt
+++ b/test/markup/bash/strings.expect.txt
@@ -2,11 +2,11 @@ SCRIPT_DIR="$( cd "$SCRIPT_DIR/../src/main/resources/tls"
ROOT_DIR="$SCRIPT_DIR/.."
-jshell -s - << EOF
+jshell -s - << EOF
System.out.printf("Procs: %s%n", getdata())
EOF
-jshell -s - <<<'System.out.printf("Procs: %s%n", getdata())'
+jshell -s - <<<'System.out.printf("Procs: %s%n", getdata())'
cat <<< '$VARIABLE'
cat <<< "$VARIABLE"
diff --git a/test/markup/bash/subcommand-starts-with-built-in.expect.txt b/test/markup/bash/subcommand-starts-with-built-in.expect.txt
new file mode 100644
index 0000000000..47d9562423
--- /dev/null
+++ b/test/markup/bash/subcommand-starts-with-built-in.expect.txt
@@ -0,0 +1 @@
+git remote set-url --push origin https://github.com/highlightjs/highlight.js.git
\ No newline at end of file
diff --git a/test/markup/bash/subcommand-starts-with-built-in.txt b/test/markup/bash/subcommand-starts-with-built-in.txt
new file mode 100644
index 0000000000..cd531bea96
--- /dev/null
+++ b/test/markup/bash/subcommand-starts-with-built-in.txt
@@ -0,0 +1 @@
+git remote set-url --push origin https://github.com/highlightjs/highlight.js.git
\ No newline at end of file
diff --git a/test/markup/bash/token-containing-keyword.expect.txt b/test/markup/bash/token-containing-keyword.expect.txt
index 90f9d8df2f..b8a6c3c3ad 100644
--- a/test/markup/bash/token-containing-keyword.expect.txt
+++ b/test/markup/bash/token-containing-keyword.expect.txt
@@ -1,5 +1,5 @@
-mycmd --disable-foo
+mycmd --disable-foo
some-cmd set-some-setting
diff --git a/test/markup/dockerfile/default.expect.txt b/test/markup/dockerfile/default.expect.txt
index a3aafcb9a0..ec21dd3c37 100644
--- a/test/markup/dockerfile/default.expect.txt
+++ b/test/markup/dockerfile/default.expect.txt
@@ -7,7 +7,7 @@
COPY www.conf /etc/php5/fpm/pool.d/
RUN apt-get update \
- && apt-get install -y php5-fpm php-apc php5-curl php5-gd php5-intl php5-mysql
+ && apt-get install -y php5-fpm php-apc php5-curl php5-gd php5-intl php5-mysql
RUN mkdir /tmp/sessions
ENV APPLICATION_ENV dev
diff --git a/test/markup/shell/command-continuation.expect.txt b/test/markup/shell/command-continuation.expect.txt
index 056b9eb520..88cb97a698 100644
--- a/test/markup/shell/command-continuation.expect.txt
+++ b/test/markup/shell/command-continuation.expect.txt
@@ -1,14 +1,14 @@
$ docker run \
- --publish=7474:7474 --publish=7687:7687 \
- --volume=/neo4j/data:/data \
- --volume=/neo4j/plugins:/plugins \
- --volume=/neo4j/conf:/conf \
- --volume=/logs/neo4j:/logs \
- --user="$(id -u neo4j):$(id -g neo4j)" \
- --group-add=$groups \
+ --publish=7474:7474 --publish=7687:7687 \
+ --volume=/neo4j/data:/data \
+ --volume=/neo4j/plugins:/plugins \
+ --volume=/neo4j/conf:/conf \
+ --volume=/logs/neo4j:/logs \
+ --user="$(id -u neo4j):$(id -g neo4j)" \
+ --group-add=$groups \
neo4j:3.4
> /bin/cat \.travis.yml\
- -b | head -n1
+ -b | head -n1
1 language: node_js
> echo 'hello'
hello
diff --git a/test/markup/shell/single.expect.txt b/test/markup/shell/single.expect.txt
index 0f1d3f79e2..0df8481721 100644
--- a/test/markup/shell/single.expect.txt
+++ b/test/markup/shell/single.expect.txt
@@ -1 +1 @@
-$ echo "$HOME" -n
+$ echo "$HOME" -n