FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
pythonVSCode/src/client/common/envFileParser.ts at master · robertsk50/pythonVSCode · GitHub
robertsk50
/
pythonVSCode
Public
forked from
DonJayamanne/pythonVSCode
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
pythonVSCode
/
src
/
client
/
common
/
envFileParser.ts
Copy path
More file actions
More file actions
Latest commit
History
History
History
27 lines (24 loc) · 898 Bytes
Breadcrumbs
pythonVSCode
/
src
/
client
/
common
/
envFileParser.ts
Copy path
File metadata and controls
27 lines (24 loc) · 898 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import
*
as
fs
from
'fs'
;
export
function
parseEnvFile
(
envFile
:
string
)
:
any
{
const
buffer
=
fs
.
readFileSync
(
envFile
,
'utf8'
)
;
const
env
=
{
}
;
buffer
.
split
(
'\n'
)
.
forEach
(
line
=>
{
const
r
=
line
.
match
(
/
^
\s
*
(
[
\w
\.
\-
]
+
)
\s
*
=
\s
*
(
.
*
)
?
\s
*
$
/
)
;
if
(
r
!==
null
)
{
let
value
=
r
[
2
]
||
''
;
if
(
value
.
length
>
0
&&
value
.
charAt
(
0
)
===
'"'
&&
value
.
charAt
(
value
.
length
-
1
)
===
'"'
)
{
value
=
value
.
replace
(
/
\\
n
/
gm
,
'\n'
)
;
}
env
[
r
[
1
]
]
=
value
.
replace
(
/
(
^
[
'
"
]
|
[
'
"
]
$
)
/
g
,
''
)
;
}
}
)
;
return
mergeEnvVariables
(
env
)
;
}
export
function
mergeEnvVariables
(
newVariables
:
{
[
key
:
string
]
:
string
}
,
mergeWith
:
any
=
process
.
env
)
:
any
{
for
(
let
setting
in
mergeWith
)
{
if
(
!
newVariables
[
setting
]
)
{
newVariables
[
setting
]
=
mergeWith
[
setting
]
;
}
}
return
newVariables
;
}
Back
|
FazBrowse Home
|
New Git URL