Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Dunitrust
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
46
Issues
46
List
Boards
Labels
Service Desk
Milestones
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nodes
rust
Dunitrust
Commits
4de69b54
Commit
4de69b54
authored
May 04, 2019
by
Éloïs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[fix] durs+core: cargo env vars must be call in binary crate
parent
787825ff
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
47 deletions
+36
-47
bin/durs-server/src/main.rs
bin/durs-server/src/main.rs
+21
-27
lib/core/core/src/commands/mod.rs
lib/core/core/src/commands/mod.rs
+15
-5
lib/core/core/src/lib.rs
lib/core/core/src/lib.rs
+0
-15
No files found.
bin/durs-server/src/main.rs
View file @
4de69b54
...
...
@@ -42,42 +42,36 @@ pub use durs_tui::TuiModule;
pub
use
durs_ws2p_v1_legacy
::{
WS2PModule
,
WS2POpt
};
//pub use durs_ws2p::WS2Pv2Module;
/// Durs cli main macro
macro_rules!
durs_cli_main
{
(
$closure_plug:expr
)
=>
{{
init
();
if
let
Err
(
err
)
=
DursCliOpt
::
from_args
()
.into_durs_command
()
.execute
(
env!
(
"CARGO_PKG_NAME"
),
env!
(
"CARGO_PKG_VERSION"
),
$closure_plug
,
)
{
println!
(
"{}"
,
err
);
error!
(
"{}"
,
err
);
}
}};
}
/// Durs command line edition, main function
#[cfg(unix)]
#[cfg(not(target_arch
=
"arm"
))]
fn
main
()
{
init
();
if
let
Err
(
err
)
=
DursCliOpt
::
from_args
()
.into_durs_command
()
.execute
(
durs_plug!
(
[
WS2PModule
],
[
TuiModule
/*, SkeletonModule ,DasaModule*/
]
))
{
println!
(
"{}"
,
err
);
error!
(
"{}"
,
err
);
}
durs_cli_main!
(
durs_plug!
(
[
WS2PModule
],
[
TuiModule
/*, SkeletonModule ,DasaModule*/
]
))
}
#[cfg(unix)]
#[cfg(target_arch
=
"arm"
)]
fn
main
()
{
init
();
if
let
Err
(
err
)
=
DursCliOpt
::
from_args
()
.into_durs_command
()
.execute
(
durs_plug!
([
WS2PModule
],
[
TuiModule
/*, SkeletonModule*/
]))
{
println!
(
"{}"
,
err
);
error!
(
"{}"
,
err
);
}
durs_cli_main!
(
durs_plug!
([
WS2PModule
],
[
TuiModule
/*, SkeletonModule*/
]))
}
#[cfg(windows)]
fn
main
()
{
init
();
if
let
Err
(
err
)
=
DursCliOpt
::
from_args
()
.into_durs_command
()
.execute
(
durs_plug!
([
WS2PModule
],
[]))
{
println!
(
"{}"
,
err
);
error!
(
"{}"
,
err
);
}
durs_cli_main!
(
durs_plug!
([
WS2PModule
],
[]))
}
lib/core/core/src/commands/mod.rs
View file @
4de69b54
...
...
@@ -22,7 +22,7 @@ pub mod reset;
pub
mod
start
;
use
crate
::
errors
::
DursCoreError
;
use
crate
::
{
durs_exec_core_cmd
,
DursCore
}
;
use
crate
::
DursCore
;
pub
use
dbex
::
*
;
pub
use
duniter_network
::
cli
::
sync
::
SyncOpt
;
use
durs_conf
::
DuRsConf
;
...
...
@@ -77,14 +77,24 @@ pub enum DursCommandEnum<T: ExecutableModuleCommand> {
impl
<
T
:
ExecutableModuleCommand
>
DursCommand
<
T
>
{
/// Execute Durs command
pub
fn
execute
<
PlugFunc
>
(
self
,
plug_modules
:
PlugFunc
)
->
Result
<
(),
DursCoreError
>
pub
fn
execute
<
PlugFunc
>
(
self
,
soft_name
:
&
'static
str
,
soft_version
:
&
'static
str
,
plug_modules
:
PlugFunc
,
)
->
Result
<
(),
DursCoreError
>
where
PlugFunc
:
FnMut
(
&
mut
DursCore
<
DuRsConf
>
)
->
Result
<
(),
DursCoreError
>
,
{
match
self
.command
{
DursCommandEnum
::
Core
(
core_cmd
)
=>
{
durs_exec_core_cmd!
(
core_cmd
,
self
.options
,
plug_modules
,)
}
DursCommandEnum
::
Core
(
core_cmd
)
=>
DursCore
::
execute_core_command
(
core_cmd
,
self
.options
,
vec!
[],
plug_modules
,
soft_name
,
soft_version
,
),
DursCommandEnum
::
Other
(
cmd
)
=>
cmd
.execute_module_command
(
self
.options
),
}
}
...
...
lib/core/core/src/lib.rs
View file @
4de69b54
...
...
@@ -56,21 +56,6 @@ use std::path::PathBuf;
use
std
::
sync
::
mpsc
;
use
std
::
thread
;
#[macro_export]
/// Durs execute core command
macro_rules!
durs_exec_core_cmd
{
(
$core_command:expr
,
$options:expr
,
$closure_plug:expr
,
)
=>
{{
DursCore
::
execute_core_command
(
$core_command
,
$options
,
vec!
[],
$closure_plug
,
env!
(
"CARGO_PKG_NAME"
),
env!
(
"CARGO_PKG_VERSION"
),
)
}};
}
#[macro_export]
/// Plug modules in durs core
macro_rules!
durs_plug
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment