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

Commit

Permalink
Rust fmt changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ashleymichal committed May 23, 2019
1 parent 354d253 commit e5a2771
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 20 deletions.
13 changes: 7 additions & 6 deletions src/commands/config.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use std::fs;
use std::path::Path;

use crate::user::settings::GlobalUserSettings;
use crate::emoji;
use crate::user::settings::GlobalUserSettings;

pub fn global_config(email: &str, api_key: &str) -> Result<(), failure::Error> {
let s = GlobalUserSettings {
Expand All @@ -12,11 +12,12 @@ pub fn global_config(email: &str, api_key: &str) -> Result<(), failure::Error> {

let toml = toml::to_string(&s)?;

let config_dir =
Path::new(&dirs::home_dir()
.expect(&format!("{0} could not determine home directory. {0}", emoji::CONSTRUCTION)))
.join(".wrangler")
.join("config");
let config_dir = Path::new(&dirs::home_dir().expect(&format!(
"{0} could not determine home directory. {0}",
emoji::CONSTRUCTION
)))
.join(".wrangler")
.join("config");
fs::create_dir_all(&config_dir)?;

let config_file = config_dir.join("default.toml");
Expand Down
8 changes: 6 additions & 2 deletions src/commands/whoami.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
use crate::user::User;
use crate::emoji;
use crate::user::User;

pub fn whoami(user: &User) {
let user = &user.data;

println!("{} You are logged with the email '{}'.", emoji::WAVING, user.email);
println!(
"{} You are logged with the email '{}'.",
emoji::WAVING,
user.email
);
}
1 change: 0 additions & 1 deletion src/emoji.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,3 @@ pub static CONSTRUCTION: Emoji = Emoji("🚧 ", "");
pub static UP: Emoji = Emoji("🆙 ", "");
pub static GOAT: Emoji = Emoji("🐑 ", "");
pub static WAVING: Emoji = Emoji("👋 ", "");

31 changes: 20 additions & 11 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ fn main() -> Result<(), failure::Error> {
.author("ashley g williams <ashley666ashley@gmail.com>")
.subcommand(
SubCommand::with_name("generate")
.about(&*format!("{} Generate a new wasm worker project", emoji::DANCERS))
.about(&*format!(
"{} Generate a new wasm worker project",
emoji::DANCERS
))
.arg(
Arg::with_name("name")
.help("the name of your worker! defaults to 'wasm-worker'")
Expand All @@ -37,7 +40,10 @@ fn main() -> Result<(), failure::Error> {
)
.subcommand(
SubCommand::with_name("preview")
.about(&*format!("{} Publish your code temporarily on cloudflareworkers.com", emoji::MICROSCOPE))
.about(&*format!(
"{} Publish your code temporarily on cloudflareworkers.com",
emoji::MICROSCOPE
))
.arg(
Arg::with_name("method")
.help("Type of request to preview your worker with (get, post)")
Expand All @@ -53,13 +59,16 @@ fn main() -> Result<(), failure::Error> {
SubCommand::with_name("build")
.about(&*format!("{} Build your wasm with wasm-pack", emoji::CRAB)),
)
.subcommand(
SubCommand::with_name("publish")
.about(&*format!("{} Push your worker to the orange cloud", emoji::UP)),
)
.subcommand(SubCommand::with_name("publish").about(&*format!(
"{} Push your worker to the orange cloud",
emoji::UP
)))
.subcommand(
SubCommand::with_name("config")
.about(&*format!("{} Setup wrangler with your Cloudflare account", emoji::SLEUTH))
.about(&*format!(
"{} Setup wrangler with your Cloudflare account",
emoji::SLEUTH
))
.arg(
Arg::with_name("email")
.help("the email address associated with your Cloudflare account")
Expand All @@ -73,10 +82,10 @@ fn main() -> Result<(), failure::Error> {
.required(true),
),
)
.subcommand(
SubCommand::with_name("whoami")
.about(&*format!("{} Retrieve your user info and test your auth config", emoji::SLEUTH))
)
.subcommand(SubCommand::with_name("whoami").about(&*format!(
"{} Retrieve your user info and test your auth config",
emoji::SLEUTH
)))
.get_matches();

if matches.subcommand_matches("config").is_some()
Expand Down

0 comments on commit e5a2771

Please sign in to comment.