mirror of
https://github.com/sharkdp/bat
synced 2024-11-18 15:26:16 +00:00
feat: add syntax sample for dotEnv files
This commit is contained in:
parent
6bf7b79f13
commit
c71c8980cf
57
tests/syntax-tests/highlighted/DotENV/.env
Normal file
57
tests/syntax-tests/highlighted/DotENV/.env
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
[38;2;117;113;94m#[0m[38;2;117;113;94m Keyword[0m
|
||||||
|
[38;2;249;38;114mexport[0m[38;2;248;248;242m [0m[38;2;255;255;255mTEST_KEYWORD[0m[38;2;249;38;114m=[0m[38;2;230;219;116m"[0m[38;2;230;219;116mbar[0m[38;2;230;219;116m"[0m
|
||||||
|
[38;2;249;38;114mexport[0m[38;2;248;248;242m [0m[38;2;255;255;255mTEST_KEYWORD[0m[38;2;249;38;114m=[0m[38;2;190;132;255m12345[0m
|
||||||
|
[38;2;249;38;114mexport[0m[38;2;248;248;242m [0m[38;2;255;255;255mTEST_KEYWORD[0m[38;2;249;38;114m=[0m[38;2;190;132;255mTRUE[0m
|
||||||
|
|
||||||
|
[38;2;117;113;94m#[0m[38;2;117;113;94m Variable[0m
|
||||||
|
[38;2;255;255;255mTEST_VARIABLE[0m[38;2;249;38;114m=[0m[38;2;230;219;116m"[0m[38;2;230;219;116mHello[0m[38;2;230;219;116m"[0m
|
||||||
|
|
||||||
|
[38;2;117;113;94m#[0m[38;2;117;113;94m String interpolation[0m
|
||||||
|
[38;2;255;255;255mTEST_INTERPOLATION_VARIABLE[0m[38;2;249;38;114m=[0m[38;2;230;219;116m"[0m[38;2;255;255;255m$[0m[38;2;255;255;255mVAR1[0m[38;2;230;219;116m test test[0m[38;2;255;255;255m$[0m[38;2;255;255;255mVAR2test[0m[38;2;230;219;116m test[0m[38;2;230;219;116m"[0m
|
||||||
|
[38;2;255;255;255mTEST_INTERPOLATION_SYNTAX_ONE[0m[38;2;249;38;114m=[0m[38;2;230;219;116m"[0m[38;2;230;219;116mtest test[0m[38;2;249;38;114m{[0m[38;2;255;255;255m$[0m[38;2;255;255;255mNVAR1[0m[38;2;249;38;114m}[0m[38;2;230;219;116mtest[0m[38;2;249;38;114m{[0m[38;2;255;255;255m$[0m[38;2;255;255;255mNVAR2[0m[38;2;249;38;114m}[0m[38;2;230;219;116mtest test[0m[38;2;230;219;116m"[0m
|
||||||
|
[38;2;255;255;255mTEST_INTERPOLATION_SYNTAX_TWO[0m[38;2;249;38;114m=[0m[38;2;230;219;116m"[0m[38;2;230;219;116mtest test[0m[38;2;249;38;114m${[0m[38;2;255;255;255mNVAR1[0m[38;2;249;38;114m}[0m[38;2;230;219;116mtest[0m[38;2;249;38;114m${[0m[38;2;255;255;255mNVAR2[0m[38;2;249;38;114m}[0m[38;2;230;219;116mtest test[0m[38;2;230;219;116m"[0m
|
||||||
|
[38;2;255;255;255mTEST_INTERPOLATION_SYNTAX_ALL[0m[38;2;249;38;114m=[0m[38;2;230;219;116m"[0m[38;2;230;219;116mtest[0m[38;2;255;255;255m$[0m[38;2;255;255;255mVAR1test[0m[38;2;230;219;116m test [0m[38;2;249;38;114m{[0m[38;2;255;255;255mVAR2[0m[38;2;249;38;114m}[0m[38;2;230;219;116mtest test[0m[38;2;249;38;114m${[0m[38;2;255;255;255mVAR3[0m[38;2;249;38;114m}[0m[38;2;230;219;116mtest[0m[38;2;230;219;116m"[0m
|
||||||
|
|
||||||
|
[38;2;117;113;94m#[0m[38;2;117;113;94m Unquoted[0m
|
||||||
|
[38;2;255;255;255mTEST_UNQUOTED[0m[38;2;249;38;114m=[0m[38;2;248;248;242mbar[0m
|
||||||
|
[38;2;255;255;255mTEST_UNQUOTED_NO_VALUE[0m[38;2;249;38;114m=[0m
|
||||||
|
|
||||||
|
[38;2;117;113;94m#[0m[38;2;117;113;94m White spaced[0m
|
||||||
|
[38;2;255;255;255mTEST_WHITE_SPACE[0m[38;2;249;38;114m =[0m
|
||||||
|
[38;2;255;255;255mTEST_WHITE_SPACE_STRING[0m[38;2;249;38;114m =[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mHello[0m[38;2;230;219;116m"[0m
|
||||||
|
[38;2;255;255;255mTEST_WHITE_SPACE_UNQUOTED[0m[38;2;249;38;114m =[0m[38;2;248;248;242m bar[0m
|
||||||
|
[38;2;255;255;255mTEST_WHITE_SPACE_UNQUOTED_BOOL[0m[38;2;249;38;114m =[0m[38;2;190;132;255m false[0m
|
||||||
|
[38;2;255;255;255mTEST_WHITE_SPACE_UNQUOTED_NUM[0m[38;2;249;38;114m =[0m[38;2;248;248;242m [0m[38;2;190;132;255m20[0m
|
||||||
|
|
||||||
|
[38;2;117;113;94m#[0m[38;2;117;113;94m language constants[0m
|
||||||
|
[38;2;255;255;255mTEST_TRUE[0m[38;2;249;38;114m=[0m[38;2;190;132;255mtrue[0m
|
||||||
|
[38;2;255;255;255mTEST_FALSE[0m[38;2;249;38;114m=[0m[38;2;190;132;255mfalse[0m
|
||||||
|
[38;2;255;255;255mTEST_NULL[0m[38;2;249;38;114m=[0m[38;2;190;132;255mnull[0m
|
||||||
|
[38;2;255;255;255mTEST_TRUE_CAPITAL[0m[38;2;249;38;114m=[0m[38;2;190;132;255mTRUE[0m
|
||||||
|
[38;2;255;255;255mTEST_FALSE_CAPITAL[0m[38;2;249;38;114m=[0m[38;2;190;132;255mFALSE[0m
|
||||||
|
[38;2;255;255;255mTEST_NULL_CAPITAL[0m[38;2;249;38;114m=[0m[38;2;190;132;255mNULL[0m
|
||||||
|
|
||||||
|
[38;2;117;113;94m#[0m[38;2;117;113;94m Numerical values[0m
|
||||||
|
[38;2;255;255;255mTEST_NUM_DECIMAL[0m[38;2;249;38;114m=[0m[38;2;190;132;255m54[0m
|
||||||
|
[38;2;255;255;255mTEST_NUM_FLOAT[0m[38;2;249;38;114m=[0m[38;2;190;132;255m5.3[0m
|
||||||
|
[38;2;255;255;255mTEST_NUM[0m[38;2;249;38;114m=[0m[38;2;190;132;255m1e10[0m
|
||||||
|
[38;2;255;255;255mTEST_NUM_NEGATIVE[0m[38;2;249;38;114m=[0m[38;2;248;248;242m-[0m[38;2;190;132;255m42[0m
|
||||||
|
[38;2;255;255;255mTEST_NUM_OCTAL[0m[38;2;249;38;114m=[0m[38;2;190;132;255m057[0m
|
||||||
|
[38;2;255;255;255mTEST_NUM_HEX[0m[38;2;249;38;114m=[0m[38;2;190;132;255m0x1A[0m
|
||||||
|
|
||||||
|
[38;2;117;113;94m#[0m[38;2;117;113;94m Comments[0m
|
||||||
|
[38;2;117;113;94m#[0m[38;2;117;113;94mTEST_ONE=foobar[0m
|
||||||
|
[38;2;117;113;94m#[0m[38;2;117;113;94m TEST_TWO='foobar'[0m
|
||||||
|
[38;2;117;113;94m#[0m[38;2;117;113;94m TEST_THREE="foobar" # a comment on a commented row[0m
|
||||||
|
[38;2;255;255;255mTEST_FOUR[0m[38;2;249;38;114m=[0m[38;2;230;219;116m"[0m[38;2;230;219;116mtest test test[0m[38;2;230;219;116m"[0m[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m this is a comment[0m
|
||||||
|
[38;2;255;255;255mTEST_FIVE[0m[38;2;249;38;114m=[0m[38;2;230;219;116m"[0m[38;2;230;219;116mcomment symbol # inside string[0m[38;2;230;219;116m"[0m[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m this is a comment[0m
|
||||||
|
[38;2;255;255;255mTEST_SIX[0m[38;2;249;38;114m=[0m[38;2;230;219;116m"[0m[38;2;230;219;116mcomment symbol # and quotes [0m[38;2;190;132;255m\"[0m[38;2;230;219;116m [0m[38;2;190;132;255m\'[0m[38;2;230;219;116m inside quotes[0m[38;2;230;219;116m"[0m[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m " this is a comment[0m
|
||||||
|
|
||||||
|
[38;2;117;113;94m#[0m[38;2;117;113;94m Escape sequences[0m
|
||||||
|
[38;2;255;255;255mTEST_ESCAPE[0m[38;2;249;38;114m=[0m[38;2;230;219;116m"[0m[38;2;230;219;116mescaped characters [0m[38;2;190;132;255m\n[0m[38;2;230;219;116m [0m[38;2;190;132;255m\t[0m[38;2;230;219;116m [0m[38;2;190;132;255m\r[0m[38;2;230;219;116m [0m[38;2;190;132;255m\"[0m[38;2;230;219;116m [0m[38;2;190;132;255m\'[0m[38;2;230;219;116m [0m[38;2;190;132;255m\$[0m[38;2;230;219;116m or maybe a backslash [0m[38;2;190;132;255m\\[0m[38;2;230;219;116m...[0m[38;2;230;219;116m"[0m
|
||||||
|
|
||||||
|
[38;2;117;113;94m#[0m[38;2;117;113;94m Double Quotes[0m
|
||||||
|
[38;2;255;255;255mTEST_DOUBLE[0m[38;2;249;38;114m=[0m[38;2;230;219;116m"[0m[38;2;230;219;116mLorem [0m[38;2;249;38;114m{[0m[38;2;255;255;255m$[0m[38;2;255;255;255mVAR1[0m[38;2;249;38;114m}[0m[38;2;230;219;116m [0m[38;2;249;38;114m${[0m[38;2;255;255;255mVAR2[0m[38;2;249;38;114m}[0m[38;2;230;219;116m [0m[38;2;255;255;255m$[0m[38;2;255;255;255mVAR3[0m[38;2;230;219;116m ipsum dolor sit amet[0m[38;2;190;132;255m\n[0m[38;2;190;132;255m\r[0m[38;2;190;132;255m\t[0m[38;2;190;132;255m\\[0m[38;2;230;219;116m"[0m
|
||||||
|
|
||||||
|
[38;2;117;113;94m#[0m[38;2;117;113;94m Single Quotes[0m
|
||||||
|
[38;2;255;255;255mTEST_SINGLE[0m[38;2;249;38;114m=[0m[38;2;230;219;116m'[0m[38;2;230;219;116mLorem {$VAR1} ${VAR2} $VAR3 ipsum dolor sit amet\n\r\t\\[0m[38;2;230;219;116m'[0m
|
57
tests/syntax-tests/source/DotENV/.env
Normal file
57
tests/syntax-tests/source/DotENV/.env
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
# Keyword
|
||||||
|
export TEST_KEYWORD="bar"
|
||||||
|
export TEST_KEYWORD=12345
|
||||||
|
export TEST_KEYWORD=TRUE
|
||||||
|
|
||||||
|
# Variable
|
||||||
|
TEST_VARIABLE="Hello"
|
||||||
|
|
||||||
|
# String interpolation
|
||||||
|
TEST_INTERPOLATION_VARIABLE="$VAR1 test test$VAR2test test"
|
||||||
|
TEST_INTERPOLATION_SYNTAX_ONE="test test{$NVAR1}test{$NVAR2}test test"
|
||||||
|
TEST_INTERPOLATION_SYNTAX_TWO="test test${NVAR1}test${NVAR2}test test"
|
||||||
|
TEST_INTERPOLATION_SYNTAX_ALL="test$VAR1test test {VAR2}test test${VAR3}test"
|
||||||
|
|
||||||
|
# Unquoted
|
||||||
|
TEST_UNQUOTED=bar
|
||||||
|
TEST_UNQUOTED_NO_VALUE=
|
||||||
|
|
||||||
|
# White spaced
|
||||||
|
TEST_WHITE_SPACE =
|
||||||
|
TEST_WHITE_SPACE_STRING = "Hello"
|
||||||
|
TEST_WHITE_SPACE_UNQUOTED = bar
|
||||||
|
TEST_WHITE_SPACE_UNQUOTED_BOOL = false
|
||||||
|
TEST_WHITE_SPACE_UNQUOTED_NUM = 20
|
||||||
|
|
||||||
|
# language constants
|
||||||
|
TEST_TRUE=true
|
||||||
|
TEST_FALSE=false
|
||||||
|
TEST_NULL=null
|
||||||
|
TEST_TRUE_CAPITAL=TRUE
|
||||||
|
TEST_FALSE_CAPITAL=FALSE
|
||||||
|
TEST_NULL_CAPITAL=NULL
|
||||||
|
|
||||||
|
# Numerical values
|
||||||
|
TEST_NUM_DECIMAL=54
|
||||||
|
TEST_NUM_FLOAT=5.3
|
||||||
|
TEST_NUM=1e10
|
||||||
|
TEST_NUM_NEGATIVE=-42
|
||||||
|
TEST_NUM_OCTAL=057
|
||||||
|
TEST_NUM_HEX=0x1A
|
||||||
|
|
||||||
|
# Comments
|
||||||
|
#TEST_ONE=foobar
|
||||||
|
# TEST_TWO='foobar'
|
||||||
|
# TEST_THREE="foobar" # a comment on a commented row
|
||||||
|
TEST_FOUR="test test test" # this is a comment
|
||||||
|
TEST_FIVE="comment symbol # inside string" # this is a comment
|
||||||
|
TEST_SIX="comment symbol # and quotes \" \' inside quotes" # " this is a comment
|
||||||
|
|
||||||
|
# Escape sequences
|
||||||
|
TEST_ESCAPE="escaped characters \n \t \r \" \' \$ or maybe a backslash \\..."
|
||||||
|
|
||||||
|
# Double Quotes
|
||||||
|
TEST_DOUBLE="Lorem {$VAR1} ${VAR2} $VAR3 ipsum dolor sit amet\n\r\t\\"
|
||||||
|
|
||||||
|
# Single Quotes
|
||||||
|
TEST_SINGLE='Lorem {$VAR1} ${VAR2} $VAR3 ipsum dolor sit amet\n\r\t\\'
|
23
tests/syntax-tests/source/DotENV/LICENSE.md
Normal file
23
tests/syntax-tests/source/DotENV/LICENSE.md
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
The `.env.test` file has been added from https://github.com/zaynali53/DotENV under the following license:
|
||||||
|
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2016 Zayn Ali
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
Loading…
Reference in New Issue
Block a user