Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
徽霖
Vscode
提交
b1351708
V
Vscode
项目概览
徽霖
/
Vscode
通知
9
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
Vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b1351708
编写于
4月 25, 2016
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove parseOpts
上级
f50d9efb
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
32 addition
and
23 deletion
+32
-23
src/vs/workbench/electron-main/argv.ts
src/vs/workbench/electron-main/argv.ts
+18
-2
src/vs/workbench/electron-main/env.ts
src/vs/workbench/electron-main/env.ts
+14
-21
未找到文件。
src/vs/workbench/electron-main/argv.ts
浏览文件 @
b1351708
...
...
@@ -11,6 +11,16 @@ export interface ParsedArgs extends minimist.ParsedArgs {
help
:
boolean
;
version
:
boolean
;
wait
:
boolean
;
diff
:
boolean
;
goto
:
boolean
;
'
new-window
'
:
boolean
;
'
reuse-window
'
:
boolean
;
locale
:
string
;
'
user-data-dir
'
:
string
;
performance
:
boolean
;
verbose
:
boolean
;
logExtensionHostCommunication
:
boolean
;
'
disable-extensions
'
:
boolean
;
}
const
options
:
minimist
.
Opts
=
{
...
...
@@ -25,7 +35,11 @@ const options: minimist.Opts = {
'
diff
'
,
'
goto
'
,
'
new-window
'
,
'
reuse-window
'
'
reuse-window
'
,
'
performance
'
,
'
verbose
'
,
'
logExtensionHostCommunication
'
,
'
disable-extensions
'
],
alias
:
{
help
:
'
h
'
,
...
...
@@ -34,7 +48,9 @@ const options: minimist.Opts = {
diff
:
'
d
'
,
goto
:
'
g
'
,
'
new-window
'
:
'
n
'
,
'
reuse-window
'
:
'
r
'
'
reuse-window
'
:
'
r
'
,
performance
:
'
p
'
,
'
disable-extensions
'
:
'
disableExtensions
'
}
};
...
...
src/vs/workbench/electron-main/env.ts
浏览文件 @
b1351708
...
...
@@ -18,6 +18,7 @@ import uri from 'vs/base/common/uri';
import
types
=
require
(
'
vs/base/common/types
'
);
import
{
ServiceIdentifier
,
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
product
,
{
IProductConfiguration
}
from
'
./product
'
;
import
{
parseArgs
}
from
'
./argv
'
;
export
interface
IProcessEnvironment
{
[
key
:
string
]:
string
;
...
...
@@ -155,28 +156,29 @@ export class EnvService implements IEnvironmentService {
debugExtensionHostPort
=
parseNumber
(
args
,
'
--debugPluginHost
'
,
5870
,
this
.
isBuilt
?
void
0
:
5870
);
}
const
opts
=
parseOpts
(
args
);
const
gotoLineMode
=
!!
opts
[
'
g
'
]
||
!!
opts
[
'
goto
'
];
const
pathArguments
=
parsePathArguments
(
this
.
_currentWorkingDirectory
,
args
,
gotoLineMode
);
const
argv
=
parseArgs
(
args
);
const
pathArguments
=
parsePathArguments
(
this
.
_currentWorkingDirectory
,
args
,
argv
.
goto
);
this
.
_cliArgs
=
Object
.
freeze
({
pathArguments
:
pathArguments
,
programStart
:
parseNumber
(
args
,
'
--timestamp
'
,
0
,
0
),
enablePerformance
:
!!
opts
[
'
p
'
]
,
verboseLogging
:
!!
opts
[
'
verbose
'
]
,
enablePerformance
:
argv
.
performance
,
verboseLogging
:
argv
.
verbose
,
debugExtensionHostPort
:
debugExtensionHostPort
,
debugBrkExtensionHost
:
debugBrkExtensionHost
,
logExtensionHostCommunication
:
!!
opts
[
'
logExtensionHostCommunication
'
]
,
openNewWindow
:
!!
opts
[
'
n
'
]
||
!!
opts
[
'
new-window
'
],
openInSameWindow
:
!!
opts
[
'
r
'
]
||
!!
opts
[
'
reuse-window
'
],
gotoLineMode
:
gotoLineMode
,
diffMode
:
(
!!
opts
[
'
d
'
]
||
!!
opts
[
'
diff
'
])
&&
pathArguments
.
length
===
2
,
logExtensionHostCommunication
:
argv
.
logExtensionHostCommunication
,
openNewWindow
:
argv
[
'
new-window
'
],
openInSameWindow
:
argv
[
'
reuse-window
'
],
gotoLineMode
:
argv
.
goto
,
diffMode
:
argv
.
diff
&&
pathArguments
.
length
===
2
,
extensionsHomePath
:
normalizePath
(
parseString
(
args
,
'
--extensionHomePath
'
)),
extensionDevelopmentPath
:
normalizePath
(
parseString
(
args
,
'
--extensionDevelopmentPath
'
)),
extensionTestsPath
:
normalizePath
(
parseString
(
args
,
'
--extensionTestsPath
'
)),
disableExtensions
:
!!
opts
[
'
disableExtensions
'
]
||
!!
opts
[
'
disable-extensions
'
],
disableExtensions
:
argv
[
'
disable-extensions
'
],
locale
:
parseString
(
args
,
'
--locale
'
),
waitForWindowClose
:
!!
opts
[
'
w
'
]
||
!!
opts
[
'
wait
'
]
waitForWindowClose
:
argv
.
wait
});
this
.
_isTestingFromCli
=
this
.
cliArgs
.
extensionTestsPath
&&
!
this
.
cliArgs
.
debugBrkExtensionHost
;
...
...
@@ -245,15 +247,6 @@ export class EnvService implements IEnvironmentService {
}
}
type
OptionBag
=
{
[
opt
:
string
]:
boolean
;
};
function
parseOpts
(
argv
:
string
[]):
OptionBag
{
return
argv
.
filter
(
a
=>
/^-/
.
test
(
a
))
.
map
(
a
=>
a
.
replace
(
/^-*/
,
''
))
.
reduce
((
r
,
a
)
=>
{
r
[
a
]
=
true
;
return
r
;
},
<
OptionBag
>
{});
}
function
parsePathArguments
(
cwd
:
string
,
argv
:
string
[],
gotoLineMode
?:
boolean
):
string
[]
{
return
arrays
.
coalesce
(
// no invalid paths
arrays
.
distinct
(
// no duplicates
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录