Skip to content
This repository has been archived by the owner on Aug 3, 2023. It is now read-only.

Commit

Permalink
Add command parsing for wrangler zone
Browse files Browse the repository at this point in the history
  • Loading branch information
jb3 committed May 28, 2021
1 parent d421b0f commit fb2775d
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pub mod secret;
pub mod subdomain;
pub mod tail;
pub mod whoami;
pub mod zone;

pub mod exec {
pub use super::build::build;
Expand All @@ -28,6 +29,7 @@ pub mod exec {
pub use super::subdomain::subdomain;
pub use super::tail::tail;
pub use super::whoami::whoami;
pub use super::zone::zone;
}

use std::net::IpAddr;
Expand Down Expand Up @@ -242,6 +244,14 @@ pub enum Command {
#[structopt(name = "log", long)]
log: Option<PathBuf>,
},

/// Fetch details on the specified Cloudflare zone
#[structopt(name = "zone")]
Zone {
/// The zone to fetch information for
#[structopt(index = 1, required = true)]
zone: String,
},
}

#[derive(Debug, Clone, StructOpt)]
Expand Down
9 changes: 9 additions & 0 deletions src/cli/zone.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
use crate::commands;
use crate::settings::global_user::GlobalUser;

use anyhow::Result;

pub fn zone(zone: String) -> Result<()> {
log::info!("Getting User settings");
commands::zone(&GlobalUser::new()?, zone)
}
2 changes: 2 additions & 0 deletions src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ pub mod secret;
pub mod subdomain;
pub mod tail;
pub mod whoami;
pub mod zone;

pub use self::config::global_config;
pub use self::preview::run as preview;
Expand All @@ -25,6 +26,7 @@ pub use secret::{create_secret, delete_secret, list_secrets};
pub use subdomain::get_subdomain;
pub use subdomain::set_subdomain;
pub use whoami::whoami;
pub use zone::zone;

use anyhow::Result;
use regex::Regex;
Expand Down
1 change: 1 addition & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,5 +113,6 @@ fn run() -> Result<()> {
Command::Report { log } => commands::report::run(log.as_deref()).map(|_| {
eprintln!("Report submission sucessful. Thank you!");
}),
Command::Zone { zone } => exec::zone(zone),
}
}

0 comments on commit fb2775d

Please sign in to comment.