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

Commit

Permalink
Migrate straggler emojis to terminal::emoji
Browse files Browse the repository at this point in the history
  • Loading branch information
EverlastingBugstopper committed Aug 2, 2019
1 parent 1841a16 commit 58bb7ea
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
11 changes: 7 additions & 4 deletions src/commands/publish/route.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::http;
use crate::settings::global_user::GlobalUser;
use crate::settings::project::Project;
use crate::terminal::emoji;
use reqwest::header::CONTENT_TYPE;
use serde::{Deserialize, Serialize};

Expand All @@ -27,10 +28,10 @@ impl Route {
{
failure::bail!("You must provide a zone_id in your wrangler.toml before publishing!");
}

let msg_config_error = format!("{} Your project config has an error, check your `wrangler.toml`: `route` must be provided.", emoji::WARN);
Ok(Route {
script: Some(project.name.to_string()),
pattern: project.route.clone().expect("⚠️ Your project config has an error, check your `wrangler.toml`: `route` must be provided.").to_string(),
pattern: project.route.clone().expect(&msg_config_error),
})
}

Expand Down Expand Up @@ -70,7 +71,8 @@ fn get_routes(user: &GlobalUser, project: &Project) -> Result<Vec<Route>, failur

if !res.status().is_success() {
let msg = format!(
"⛔ There was an error fetching your project's routes.\n Status Code: {}\n Msg: {}",
"{} There was an error fetching your project's routes.\n Status Code: {}\n Msg: {}",
emoji::WARN,
res.status(),
res.text()?
);
Expand All @@ -97,7 +99,8 @@ fn create(user: &GlobalUser, project: &Project, route: &Route) -> Result<(), fai

if !res.status().is_success() {
let msg = format!(
"⛔ There was an error creating your route.\n Status Code: {}\n Msg: {}",
"{} There was an error creating your route.\n Status Code: {}\n Msg: {}",
emoji::WARN,
res.status(),
res.text()?
);
Expand Down
7 changes: 4 additions & 3 deletions src/commands/subdomain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,10 @@ fn subdomain_addr(account_id: &str) -> String {

pub fn subdomain(name: &str, user: &GlobalUser, project: &Project) -> Result<(), failure::Error> {
if project.account_id.is_empty() {
failure::bail!(
"⛔ You must provide an account_id in your wrangler.toml before creating a subdomain!"
)
failure::bail!(format!(
"{} You must provide an account_id in your wrangler.toml before creating a subdomain!",
emoji::WARN
))
}
let msg = format!(
"Registering your subdomain, {}.workers.dev, this could take up to a minute.",
Expand Down
7 changes: 4 additions & 3 deletions src/install/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
mod krate;
pub mod target;

use crate::terminal::emoji;

use binary_install::{Cache, Download};
use krate::Krate;
use log::info;
Expand Down Expand Up @@ -52,9 +54,8 @@ pub fn install_artifact(
fn tool_exists(tool_name: &str) -> Option<Download> {
if let Ok(path) = which(tool_name) {
log::debug!("found global {} binary at: {}", tool_name, path.display());
Some(Download::at(
path.parent().expect("⚠️ There is no path parent"),
))
let no_parent_msg = format!("{} There is no path parent", emoji::WARN);
Some(Download::at(path.parent().expect(&no_parent_msg)))
} else {
None
}
Expand Down

0 comments on commit 58bb7ea

Please sign in to comment.