1pub mod commands;
2pub mod common;
3pub mod fetch;
4pub(crate) mod log;
5pub(crate) mod types;
6
7use cw_orch::daemon::DEFAULT_DEPLOYMENT;
8
9#[derive(Debug, Clone, interactive_clap::InteractiveClap)]
10#[interactive_clap(input_context = ())]
11#[interactive_clap(output_context = GlobalConfig)]
12pub struct TLCommand {
13 #[interactive_clap(short, long, global = true)]
15 verbose: bool,
16 #[interactive_clap(short, long, global = true)]
18 source_state_file: bool,
19 #[interactive_clap(long, global = true)]
21 #[interactive_clap(skip_interactive_input)]
22 deployment_id: Option<String>,
23 #[interactive_clap(subcommand)]
24 top_level: commands::Commands,
25}
26
27#[derive(Debug, Clone)]
28pub struct GlobalConfig {
29 source_state_file: bool,
30 deployment_id: String,
31}
32
33impl GlobalConfig {
34 fn from_previous_context(
35 _previous_context: (),
36 scope: &<TLCommand as interactive_clap::ToInteractiveClapContextScope>::InteractiveClapContextScope,
37 ) -> color_eyre::eyre::Result<Self> {
38 if scope.verbose {
39 pretty_env_logger::init()
40 }
41 Ok(Self {
42 source_state_file: scope.source_state_file,
43 deployment_id: scope
44 .deployment_id
45 .clone()
46 .unwrap_or(DEFAULT_DEPLOYMENT.to_owned()),
47 })
48 }
49}
50
51impl From<GlobalConfig> for () {
52 fn from(_value: GlobalConfig) -> Self {}
53}