2
0
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:
Zachary J. Rollyson 2020-10-17 11:19:56 -04:00 committed by David Peter
parent 6bf7b79f13
commit c71c8980cf
3 changed files with 137 additions and 0 deletions

View 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\\'

View 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\\'

View 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.