1#![warn(
7 missing_debug_implementations,
10 missing_copy_implementations,
11 trivial_casts,
12 unused_allocation,
13 trivial_numeric_casts
14)]
15#![forbid(unsafe_code)]
16
17#[macro_use]
18pub mod macros;
19pub mod api;
20pub mod cli;
21pub mod config;
22pub mod context;
23pub mod error;
24pub mod fs;
25pub mod log;
26pub mod ops;
27pub mod printer;
28
29pub use crate::{
30 cli::Seaplane, config::RawConfig, context::Ctx, error::Result, log::LogLevel,
31 printer::OutputFormat,
32};
33
34#[cfg(any(feature = "ui_tests", feature = "semantic_ui_tests", feature = "api_tests"))]
35mod tests {
36 use std::ffi::OsString;
37
38 use clap::ArgMatches;
39
40 use crate::{
41 cli::{CliCommand, Seaplane},
42 context::Ctx,
43 error::Result,
44 };
45
46 pub fn test_cli<I, T>(argv: I) -> Result<ArgMatches>
47 where
48 I: IntoIterator<Item = T>,
49 T: Into<OsString> + Clone,
50 {
51 let matches = Seaplane::command().try_get_matches_from(argv)?;
52
53 _ = matches.get_one::<u8>("verbose").copied();
55 _ = matches.get_one::<u8>("quiet").copied();
56 _ = matches.get_flag("stateless");
57 Ok(matches)
58 }
59
60 pub fn test_main_update_ctx(matches: &ArgMatches) -> Result<()> {
61 let mut ctx = Ctx::default();
62 let s: Box<dyn CliCommand> = Box::new(Seaplane);
63 s.traverse_update_ctx(&matches, &mut ctx)?;
64 Ok(())
65 }
66
67 pub fn test_main_exec_with_ctx(matches: &ArgMatches, mut ctx: Ctx) -> Result<()> {
68 let s: Box<dyn CliCommand> = Box::new(Seaplane);
69 s.traverse_exec(&matches, &mut ctx)?;
70 Ok(())
71 }
72}
73
74#[cfg(any(feature = "ui_tests", feature = "semantic_ui_tests", feature = "api_tests"))]
75pub use tests::{test_cli, test_main_exec_with_ctx, test_main_update_ctx};