refactor: move commands and misc out of main binary package

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
2023-08-01 15:34:24 +02:00
parent 8b83b9c14d
commit c7793f7422
24 changed files with 580 additions and 460 deletions

View File

@@ -1,7 +1,7 @@
pub mod common;
use common::BufferUi;
use cuddle_please::command::Command;
use cuddle_please_commands::PleaseCommand;
use tracing_test::traced_test;
use crate::common::{assert_output, get_test_data_path};
@@ -17,7 +17,7 @@ fn test_config_from_current_dir() {
let ui = &BufferUi::default();
let current_dir = get_test_data_path("cuddle-embed");
Command::new_from_args(Some(ui), args)
PleaseCommand::new_from_args(Some(ui), args)
.execute(Some(&current_dir))
.unwrap();
@@ -33,7 +33,7 @@ fn test_config_from_source_dir() {
args.push("--source");
args.push(current_dir.to_str().unwrap());
Command::new_from_args(Some(ui), args)
PleaseCommand::new_from_args(Some(ui), args)
.execute(None)
.unwrap();
@@ -55,7 +55,7 @@ settings:
"#;
args.push("--config-stdin");
Command::new_from_args_with_stdin(Some(ui), args, || Ok(config.into()))
PleaseCommand::new_from_args_with_stdin(Some(ui), args, || Ok(config.into()))
.execute(None)
.unwrap();
assert_output(ui, "cuddle-config\n", "");
@@ -67,7 +67,7 @@ fn test_config_fails_when_not_path_is_set() {
let args = get_base_args();
let ui = &BufferUi::default();
let res = Command::new_from_args(Some(ui), args).execute(None);
let res = PleaseCommand::new_from_args(Some(ui), args).execute(None);
assert!(res.is_err())
}