Skip to content
GitLab
菜单
为什么选择 GitLab
定价
联系销售
探索
为什么选择 GitLab
定价
联系销售
探索
登录
获取免费试用
主导航
搜索或转到…
项目
Z
zap
管理
动态
成员
标记
计划
议题
议题看板
里程碑
迭代
Wiki
代码
合并请求
仓库
分支
提交
标签
仓库图
比较修订版本
代码片段
锁定的文件
构建
流水线
作业
流水线计划
产物
部署
发布
Package registry
容器镜像库
模型注册表
运维
环境
Terraform 模块
监控
事件
服务台
分析
价值流分析
贡献者分析
CI/CD 分析
仓库分析
代码评审分析
议题分析
模型实验
效能分析
帮助
帮助
支持
GitLab 文档
比较 GitLab 各版本
社区论坛
为极狐GitLab 提交贡献
提交反馈
隐私声明
快捷键
?
新增功能
4
代码片段
群组
项目
显示更多面包屑
esp-mirror
project-chip
zap
提交
828bdc6c
提交
828bdc6c
编辑于
4 years ago
作者:
Timotej Ecimovic
浏览文件
操作
下载
补丁
差异文件
Migrate args to common JS module.
上级
ec8b3aae
No related branches found
No related tags found
无相关合并请求
变更
3
隐藏空白变更内容
行内
左右并排
显示
3 个更改的文件
src-electron/main-process/args.js
+9
-7
9 个添加, 7 个删除
src-electron/main-process/args.js
src-electron/main-process/electron-main.js
+8
-8
8 个添加, 8 个删除
src-electron/main-process/electron-main.js
test/arg.test.js
+8
-8
8 个添加, 8 个删除
test/arg.test.js
有
25 个添加
和
23 个删除
src-electron/main-process/args.js
+
9
−
7
浏览文件 @
828bdc6c
...
...
@@ -19,8 +19,8 @@ const yargs = require('yargs')
const
{
logInfo
}
=
require
(
'
../util/env.js
'
)
// TODO how to handle relative pathing for things like properties file.
export
var
zclPropertiesFile
=
'
./test/zcl/zcl-test.properties
'
export
var
httpPort
=
9070
export
s
.
zclPropertiesFile
=
'
./test/zcl/zcl-test.properties
'
export
s
.
httpPort
=
9070
/**
* Process the command line arguments and resets the state in this file
...
...
@@ -30,7 +30,7 @@ export var httpPort = 9070
* @param {*} argv
* @returns parsed argv object
*/
export
function
processCommandLineArguments
(
argv
)
{
function
processCommandLineArguments
(
argv
)
{
var
ret
=
yargs
.
command
(
'
generate
'
,
'
Generate ZCL artifacts.
'
,
(
yargs
)
=>
{
yargs
.
positional
(
'
outputDir
'
,
{
...
...
@@ -44,13 +44,13 @@ export function processCommandLineArguments(argv) {
desc
:
'
Port used for the HTTP server
'
,
alias
:
'
p
'
,
type
:
'
number
'
,
default
:
httpPort
,
default
:
exports
.
httpPort
,
})
.
option
(
'
zclProperties
'
,
{
desc
:
'
zcl.properties file to read in.
'
,
alias
:
'
zcl
'
,
type
:
'
string
'
,
default
:
zclPropertiesFile
,
default
:
exports
.
zclPropertiesFile
,
})
.
option
(
'
noUi
'
,
{
desc
:
"
Don't show the main window when starting.
"
,
...
...
@@ -75,8 +75,10 @@ export function processCommandLineArguments(argv) {
logInfo
(
'
Command line arguments:
'
)
logInfo
(
ret
)
zclPropertiesFile
=
ret
.
zclProperties
httpPort
=
ret
.
httpPort
exports
.
zclPropertiesFile
=
ret
.
zclProperties
exports
.
httpPort
=
ret
.
httpPort
return
ret
}
exports
.
processCommandLineArguments
=
processCommandLineArguments
此差异已折叠。
点击以展开。
src-electron/main-process/electron-main.js
+
8
−
8
浏览文件 @
828bdc6c
...
...
@@ -21,7 +21,7 @@ import { version } from '../../package.json'
import
{
closeDatabase
,
initDatabase
,
loadSchema
}
from
'
../db/db-api.js
'
import
{
initHttpServer
,
httpServerPort
}
from
'
../server/http-server.js
'
import
{
loadZcl
}
from
'
../zcl/zcl-loader.js
'
import
*
as
Args
from
'
./args.js
'
const
Args
=
require
(
'
./args.js
'
)
const
{
logError
,
logInfo
,
...
...
@@ -59,7 +59,7 @@ function startSelfCheck() {
initDatabase
(
sqliteFile
())
.
then
((
db
)
=>
attachToDb
(
db
))
.
then
((
db
)
=>
loadSchema
(
db
,
schemaFile
(),
version
))
.
then
((
db
)
=>
loadZcl
(
db
,
A
rgs
.
zclPropertiesFile
))
.
then
((
db
)
=>
loadZcl
(
db
,
a
rgs
.
zclPropertiesFile
))
.
then
(()
=>
{
logInfo
(
'
Self-check done!
'
)
})
...
...
@@ -73,8 +73,8 @@ function startNormal(ui, showUrl) {
initDatabase
(
sqliteFile
())
.
then
((
db
)
=>
attachToDb
(
db
))
.
then
((
db
)
=>
loadSchema
(
db
,
schemaFile
(),
version
))
.
then
((
db
)
=>
loadZcl
(
db
,
A
rgs
.
zclPropertiesFile
))
.
then
((
db
)
=>
initHttpServer
(
db
,
A
rgs
.
httpPort
))
.
then
((
db
)
=>
loadZcl
(
db
,
a
rgs
.
zclPropertiesFile
))
.
then
((
db
)
=>
initHttpServer
(
db
,
a
rgs
.
httpPort
))
.
then
(()
=>
{
if
(
ui
)
{
initializeElectronUi
(
httpServerPort
())
...
...
@@ -111,7 +111,7 @@ function applyGenerationSettings(
.
then
((
db
)
=>
loadZcl
(
db
,
zclPropertiesFilePath
?
zclPropertiesFilePath
:
A
rgs
.
zclPropertiesFile
zclPropertiesFilePath
?
zclPropertiesFilePath
:
a
rgs
.
zclPropertiesFile
)
)
.
then
((
db
)
=>
...
...
@@ -148,7 +148,7 @@ export function startSdkGeneration(
.
then
((
db
)
=>
loadZcl
(
db
,
zclPropertiesFilePath
?
zclPropertiesFilePath
:
A
rgs
.
zclPropertiesFile
zclPropertiesFilePath
?
zclPropertiesFilePath
:
a
rgs
.
zclPropertiesFile
)
)
.
then
((
db
)
=>
...
...
@@ -162,7 +162,7 @@ export function startSdkGeneration(
}
app
.
on
(
'
ready
'
,
()
=>
{
var
argv
=
A
rgs
.
processCommandLineArguments
(
process
.
argv
)
var
argv
=
a
rgs
.
processCommandLineArguments
(
process
.
argv
)
logInfo
(
argv
)
...
...
@@ -189,7 +189,7 @@ app.on('window-all-closed', () => {
app
.
on
(
'
activate
'
,
()
=>
{
logInfo
(
'
Activate...
'
)
windowCreateIfNotThere
(
A
rgs
.
httpPort
)
windowCreateIfNotThere
(
a
rgs
.
httpPort
)
})
app
.
on
(
'
quit
'
,
()
=>
{
...
...
此差异已折叠。
点击以展开。
test/arg.test.js
+
8
−
8
浏览文件 @
828bdc6c
...
...
@@ -18,11 +18,11 @@
* @jest-environment node
*/
import
{
processCommandLineArguments
}
from
'
../src-electron/main-process/args
'
impor
t
yargs
from
'
yargs
'
const
args
=
require
(
'
../src-electron/main-process/args
'
)
cons
t
yargs
=
require
(
'
yargs
'
)
test
(
'
Test basic command line processing
'
,
()
=>
{
var
a
rgs
=
processCommandLineArguments
([
var
a
=
args
.
processCommandLineArguments
([
'
node
'
,
'
test.js
'
,
'
--noUI
'
,
...
...
@@ -33,11 +33,11 @@ test('Test basic command line processing', () => {
'
XmlRoot
'
,
])
expect
(
a
rgs
.
noUI
).
toBeTruthy
()
expect
(
a
rgs
.
httpPort
).
toBeTruthy
()
expect
(
a
rgs
.
httpPort
).
toEqual
(
123
)
expect
(
a
rgs
.
arglessArg
).
toBeTruthy
()
expect
(
a
rgs
.
xmlRoot
).
toBe
(
'
XmlRoot
'
)
expect
(
a
.
noUI
).
toBeTruthy
()
expect
(
a
.
httpPort
).
toBeTruthy
()
expect
(
a
.
httpPort
).
toEqual
(
123
)
expect
(
a
.
arglessArg
).
toBeTruthy
()
expect
(
a
.
xmlRoot
).
toBe
(
'
XmlRoot
'
)
})
test
(
'
Verify how yargs works
'
,
()
=>
{
...
...
此差异已折叠。
点击以展开。
预览
0%
加载中
请重试
或
添加新附件
.
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
保存评论
取消
想要评论请
注册
或
登录