More linting.
This commit is contained in:
1 parent
f4170610b0
commit
feaab2e843
5 files changed
+26
-33
No files matched your search
+17
-17
@@ -251,14 +251,14 @@ fn process_process_events_command_line(
|
||||
}
|
||||
|
||||
fn process_run_wui_command_line(
|
||||
connFact: SQLiteConnectionFactory,
|
||||
conn_fact: SQLiteConnectionFactory,
|
||||
m: &ArgMatches,
|
||||
logic: &mut dyn CommandLineUserLogic,
|
||||
) -> CustomResult<()> {
|
||||
debug!("Processing run wui command line {:?}.", m);
|
||||
let port = m.get_one::<u16>("port").unwrap_or(&2222);
|
||||
let enable_template_autoreload = m.get_flag("enable-template-autoreload");
|
||||
logic.run_webui(connFact, *port, enable_template_autoreload)
|
||||
logic.run_webui(conn_fact, *port, enable_template_autoreload)
|
||||
}
|
||||
|
||||
fn process_securities_command_line(
|
||||
@@ -290,26 +290,26 @@ fn process_events_command_line(
|
||||
}
|
||||
|
||||
fn process_wui_command_line(
|
||||
connFact: SQLiteConnectionFactory,
|
||||
conn_fact: SQLiteConnectionFactory,
|
||||
m: &ArgMatches,
|
||||
logic: &mut dyn CommandLineUserLogic,
|
||||
) -> CustomResult<()> {
|
||||
debug!("Processing wui command line {:?}.", m);
|
||||
match m.subcommand() {
|
||||
Some(("run", run_wui_match)) => {
|
||||
process_run_wui_command_line(connFact, run_wui_match, logic)
|
||||
process_run_wui_command_line(conn_fact, run_wui_match, logic)
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
||||
fn process_command_line(
|
||||
connFact: SQLiteConnectionFactory,
|
||||
conn_fact: SQLiteConnectionFactory,
|
||||
m: &ArgMatches,
|
||||
logic: &mut dyn CommandLineUserLogic,
|
||||
) -> CustomResult<()> {
|
||||
debug!("Processing command line {:?}.", m);
|
||||
let mut conn = connFact.connection()?;
|
||||
let mut conn = conn_fact.connection()?;
|
||||
match m.subcommand() {
|
||||
Some(("users", user_match)) => process_user_command_line(&mut conn, user_match, logic),
|
||||
Some(("securities", securities_match)) => {
|
||||
@@ -318,7 +318,7 @@ fn process_command_line(
|
||||
Some(("events", events_match)) => {
|
||||
process_events_command_line(&mut conn, events_match, logic)
|
||||
}
|
||||
Some(("wui", wui_match)) => process_wui_command_line(connFact, wui_match, logic),
|
||||
Some(("wui", wui_match)) => process_wui_command_line(conn_fact, wui_match, logic),
|
||||
_ => {
|
||||
println!("Received un parsable command. {:?}", m.subcommand());
|
||||
unreachable!();
|
||||
@@ -437,7 +437,7 @@ mod cli_test {
|
||||
]);
|
||||
let mut logic = TestCommandLineLogic::new();
|
||||
let mut conn = Connection::open_in_memory().unwrap();
|
||||
process_command_line(SQLiteConnectionFactory::inMemory(), &m, &mut logic)?;
|
||||
process_command_line(SQLiteConnectionFactory::in_memory(), &m, &mut logic)?;
|
||||
assert_eq!(logic.create_user_count, 1);
|
||||
Ok(())
|
||||
}
|
||||
@@ -448,7 +448,7 @@ mod cli_test {
|
||||
let m = cmd.get_matches_from(vec!["test", "users", "ls"]);
|
||||
let mut logic = TestCommandLineLogic::new();
|
||||
let mut conn = Connection::open_in_memory().unwrap();
|
||||
process_command_line(SQLiteConnectionFactory::inMemory(), &m, &mut logic)?;
|
||||
process_command_line(SQLiteConnectionFactory::in_memory(), &m, &mut logic)?;
|
||||
assert_eq!(logic.list_user_count, 1);
|
||||
Ok(())
|
||||
}
|
||||
@@ -459,7 +459,7 @@ mod cli_test {
|
||||
let m = cmd.get_matches_from(vec!["test", "securities", "ls"]);
|
||||
let mut logic = TestCommandLineLogic::new();
|
||||
let mut conn = Connection::open_in_memory().unwrap();
|
||||
process_command_line(SQLiteConnectionFactory::inMemory(), &m, &mut logic)?;
|
||||
process_command_line(SQLiteConnectionFactory::in_memory(), &m, &mut logic)?;
|
||||
assert_eq!(logic.list_securities_count, 1);
|
||||
Ok(())
|
||||
}
|
||||
@@ -470,7 +470,7 @@ mod cli_test {
|
||||
let m = cmd.get_matches_from(vec!["test", "events", "process", "/dev/null"]);
|
||||
let mut logic = TestCommandLineLogic::new();
|
||||
let mut conn = Connection::open_in_memory().unwrap();
|
||||
process_command_line(SQLiteConnectionFactory::inMemory(), &m, &mut logic)?;
|
||||
process_command_line(SQLiteConnectionFactory::in_memory(), &m, &mut logic)?;
|
||||
assert_eq!(logic.process_events_count, 1);
|
||||
Ok(())
|
||||
}
|
||||
@@ -481,7 +481,7 @@ mod cli_test {
|
||||
let m = cmd.get_matches_from(vec!["test", "wui", "run"]);
|
||||
let mut logic = TestCommandLineLogic::new();
|
||||
let mut conn = Connection::open_in_memory().unwrap();
|
||||
process_command_line(SQLiteConnectionFactory::inMemory(), &m, &mut logic)?;
|
||||
process_command_line(SQLiteConnectionFactory::in_memory(), &m, &mut logic)?;
|
||||
assert_eq!(logic.run_webui_count, 1);
|
||||
Ok(())
|
||||
}
|
||||
@@ -532,12 +532,12 @@ impl CommandLineUserLogic for ProCommandLineLogic {
|
||||
|
||||
fn run_webui(
|
||||
&mut self,
|
||||
connFact: SQLiteConnectionFactory,
|
||||
conn_fact: SQLiteConnectionFactory,
|
||||
port: u16,
|
||||
enable_template_autoreload: bool,
|
||||
) -> CustomResult<()> {
|
||||
info!("Serving web-ui on port {:?}", port);
|
||||
web_ui_main(connFact, port, enable_template_autoreload)
|
||||
web_ui_main(conn_fact, port, enable_template_autoreload)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -560,9 +560,9 @@ fn main() -> CustomResult<()> {
|
||||
let m = command.get_matches();
|
||||
|
||||
set_logger(&m);
|
||||
let connFactory = get_connection(&m);
|
||||
let conn_factory = get_connection(&m);
|
||||
|
||||
apply_migrations(&mut connFactory.connection()?).unwrap();
|
||||
apply_migrations(&mut conn_factory.connection()?).unwrap();
|
||||
let mut logic = ProCommandLineLogic::new();
|
||||
process_command_line(connFactory, &m, &mut logic)
|
||||
process_command_line(conn_factory, &m, &mut logic)
|
||||
}
|
||||
Reference in new issue
Block a user