Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
后端镜像
Tabby
提交
9f8f2966
T
Tabby
项目概览
后端镜像
/
Tabby
通知
31
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Tabby
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
9f8f2966
编写于
10月 23, 2021
作者:
E
Eugene Pankov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fixed #4794 - env var expansion in profiles
上级
5c976948
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
35 addition
and
4 deletion
+35
-4
tabby-local/src/components/environmentEditor.component.pug
tabby-local/src/components/environmentEditor.component.pug
+10
-3
tabby-local/src/components/environmentEditor.component.ts
tabby-local/src/components/environmentEditor.component.ts
+9
-0
tabby-local/src/session.ts
tabby-local/src/session.ts
+16
-1
未找到文件。
tabby-local/src/components/environmentEditor.component.pug
浏览文件 @
9f8f2966
...
...
@@ -8,6 +8,13 @@
button.btn.btn-secondary((click)='removeEnvironmentVar(pair.key)')
i.fas.fa-fw.fa-trash
button.btn.btn-secondary((click)='addEnvironmentVar()')
i.fas.fa-plus.mr-2
span Add
.d-flex
button.btn.btn-secondary((click)='addEnvironmentVar()')
i.fas.fa-plus.mr-2
span Add
.ml-auto
.text-muted Substitutions allowed.
.d-flex.ml-1(*ngIf='shouldShowExample()')
.text-muted Example:
a.ml-1((click)='addExample()', href='#') extend PATH
tabby-local/src/components/environmentEditor.component.ts
浏览文件 @
9f8f2966
...
...
@@ -44,4 +44,13 @@ export class EnvironmentEditorComponent {
this
.
emitUpdate
()
}
shouldShowExample
():
boolean
{
return
!
this
.
vars
.
find
(
v
=>
v
.
key
.
toLowerCase
()
===
'
path
'
)
}
addExample
():
void
{
const
value
=
process
.
platform
===
'
win32
'
?
'
C:
\\
Program Files
\\
Custom:%PATH%
'
:
'
/opt/custom:$PATH
'
this
.
vars
.
push
({
key
:
'
PATH
'
,
value
})
this
.
emitUpdate
()
}
}
tabby-local/src/session.ts
浏览文件 @
9f8f2966
...
...
@@ -95,6 +95,21 @@ function mergeEnv (...envs) {
return
result
}
function
substituteEnv
(
env
:
Record
<
string
,
string
>
)
{
env
=
{
...
env
}
const
pattern
=
process
.
platform
===
'
win32
'
?
/%
(\w
+
)
%/g
:
/
\$(\w
+
)\b
/g
for
(
const
[
key
,
value
]
of
Object
.
entries
(
env
))
{
env
[
key
]
=
value
.
replace
(
pattern
,
function
(
substring
,
p1
)
{
if
(
process
.
platform
===
'
win32
'
)
{
return
Object
.
entries
(
process
.
env
).
find
(
x
=>
x
[
0
].
toLowerCase
()
===
p1
.
toLowerCase
())?.[
1
]
??
''
}
else
{
return
process
.
env
[
p1
]
??
''
}
})
}
return
env
}
/** @hidden */
export
class
Session
extends
BaseSession
{
private
pty
:
PTYProxy
|
null
=
null
...
...
@@ -128,7 +143,7 @@ export class Session extends BaseSession {
TERM
:
'
xterm-256color
'
,
TERM_PROGRAM
:
'
Tabby
'
,
},
options
.
env
,
substituteEnv
(
options
.
env
??
{})
,
this
.
config
.
store
.
terminal
.
environment
||
{},
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录