Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
R
RoboPLC
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
黄新宇
RoboPLC
Commits
c1201541
提交
c1201541
authored
2月 23, 2025
作者:
Serhij S
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
x.env section
上级
aa2364d6
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
23 行增加
和
4 行删除
+23
-4
Cargo.toml
roboplc-cli/Cargo.toml
+1
-1
config.rs
roboplc-cli/src/config.rs
+8
-0
main.rs
roboplc-cli/src/main.rs
+13
-3
project.rs
roboplc-cli/src/project.rs
+1
-0
没有找到文件。
roboplc-cli/Cargo.toml
浏览文件 @
c1201541
[package]
name
=
"roboplc-cli"
version
=
"0.5.
0
"
version
=
"0.5.
1
"
edition
=
"2021"
authors
=
[
"Serhij S. <div@altertech.com>"
]
license
=
"Apache-2.0"
...
...
roboplc-cli/src/config.rs
浏览文件 @
c1201541
...
...
@@ -10,6 +10,8 @@ pub struct Config {
pub
remote
:
Remote
,
#[serde(default)]
pub
build
:
Build
,
#[serde(default)]
pub
x
:
X
,
#[serde(default,
rename
=
"build-custom"
)]
pub
build_custom
:
BuildCustom
,
}
...
...
@@ -36,6 +38,12 @@ pub struct Build {
pub
cargo_args
:
Option
<
String
>
,
}
#[derive(Deserialize,
Serialize,
Default,
Debug)]
pub
struct
X
{
#[serde(default,
skip_serializing_if
=
"BTreeMap::is_empty"
)]
pub
env
:
BTreeMap
<
String
,
String
>
,
}
#[derive(Deserialize,
Serialize,
Default,
Debug)]
pub
struct
BuildCustom
{
#[serde(skip_serializing_if
=
"Option::is_none"
)]
...
...
roboplc-cli/src/main.rs
浏览文件 @
c1201541
use
std
::{
fs
,
time
::
Duration
};
use
std
::{
collections
::
btree_map
,
fs
,
time
::
Duration
};
use
arguments
::{
Args
,
SubCommand
};
use
arguments
::{
Args
,
FlashExec
,
SubCommand
};
use
clap
::
Parser
;
use
common
::{
find_robo_toml
,
Mode
};
use
once_cell
::
sync
::
OnceCell
;
...
...
@@ -59,6 +59,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
}
let
mut
maybe_timeout
=
args
.timeout
;
let
mut
build_config
=
None
;
let
mut
x_config
=
None
;
let
mut
build_custom
=
None
;
if
let
SubCommand
::
New
(
_
)
=
args
.subcmd
{
// do not parse robo.toml for `new` command
...
...
@@ -76,6 +77,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
}
build_config
=
Some
(
robo_toml
.build
);
build_custom
=
Some
(
robo_toml
.build_custom
);
x_config
=
Some
(
robo_toml
.x
);
}
maybe_url
=
maybe_url
.map
(|
v
|
{
let
mut
u
=
v
.trim_end_matches
(
'/'
)
.to_owned
();
...
...
@@ -133,11 +135,19 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
flashing
::
rollback
(
&
url
,
&
key
,
agent
,
opts
)
?
;
}
SubCommand
::
Exec
(
opts
)
=>
{
let
mut
opts
:
FlashExec
=
opts
.into
();
if
let
Some
(
x_conf
)
=
x_config
{
for
(
k
,
v
)
in
x_conf
.env
{
if
let
btree_map
::
Entry
::
Vacant
(
e
)
=
opts
.program_env
.entry
(
k
)
{
e
.insert
(
v
);
}
}
}
flashing
::
flash
(
&
url
,
&
key
,
agent
,
opts
.into
()
,
opts
,
build_config
.unwrap_or_default
(),
build_custom
.unwrap_or_default
(),
true
,
...
...
roboplc-cli/src/project.rs
浏览文件 @
c1201541
...
...
@@ -52,6 +52,7 @@ pub fn create(
},
build
:
<
_
>
::
default
(),
build_custom
:
<
_
>
::
default
(),
x
:
<
_
>
::
default
(),
};
if
let
Some
(
docker_arch
)
=
opts
.docker
{
robo_toml
.build.target
=
Some
(
docker_arch
.target
()
.to_owned
());
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论