Skip to content

Commit

Permalink
Updated welcome message colors (FuelLabs#1662)
Browse files Browse the repository at this point in the history
* Updated welcome message colors
  • Loading branch information
Braqzen authored May 25, 2022
1 parent ce66e64 commit c2c952b
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 28 deletions.
10 changes: 10 additions & 0 deletions forc-util/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,16 @@ pub fn println_green(txt: &str) {
println_std_out(txt, TermColor::Green);
}

pub fn print_light_blue(txt: &str) {
let stdout = StandardStream::stdout(ColorChoice::Always);
print_with_color(txt, TermColor::Rgb(40, 200, 255), stdout);
}

pub fn print_light_green(txt: &str) {
let stdout = StandardStream::stdout(ColorChoice::Always);
print_with_color(txt, TermColor::Rgb(90, 255, 40), stdout);
}

pub fn print_blue_err(txt: &str) {
print_std_err(txt, TermColor::Blue);
}
Expand Down
50 changes: 22 additions & 28 deletions forc/src/ops/forc_init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ use crate::utils::{
program_type::{ProgramType, ProgramType::*},
};
use anyhow::Result;
use forc_util::{println_green, validate_name};
use forc_util::{print_light_blue, print_light_green, validate_name};
use serde::Deserialize;
use std::fs;
use std::path::Path;
use sway_utils::constants;
use tracing::info;

#[derive(Debug, Deserialize)]
#[serde(rename_all = "lowercase")]
Expand Down Expand Up @@ -70,30 +69,25 @@ struct GithubTree {
}

fn print_welcome_message() {
let read_the_docs = format!(
"Read the Docs:\n- {}\n- {}\n- {}",
"Sway Book: https://fuellabs.github.io/sway/latest",
"Rust SDK Book: https://fuellabs.github.io/fuels-rs/latest",
"TypeScript SDK: https://github.com/FuelLabs/fuels-ts"
);

let join_the_community = format!(
"Join the Community:\n- Follow us {}
- Ask questions in dev-chat on {}",
"@SwayLang: https://twitter.com/SwayLang", "Discord: https://discord.com/invite/xfpK4Pe"
);

let report_bugs = format!(
"Report Bugs:\n- {}",
"Sway Issues: https://github.com/FuelLabs/sway/issues/new"
);

let try_forc = "To compile, use `forc build`, and to run tests use `forc test`";

info!(
"\n{}\n\n----\n\n{}\n\n{}\n\n{}\n\n",
try_forc, read_the_docs, join_the_community, report_bugs
);
print_light_green("To compile, use `forc build`, and to run tests use `forc test`\n\n");

print_light_blue("Read the Docs:\n");
print_light_green("- Sway Book: ");
print_light_blue("https://fuellabs.github.io/sway/latest\n");
print_light_green("- Rust SDK Book: ");
print_light_blue("https://fuellabs.github.io/fuels-rs/latest\n");
print_light_green("- TypeScript SDK: ");
print_light_blue("https://github.com/FuelLabs/fuels-ts\n\n");

print_light_blue("Join the Community:\n");
print_light_green("- Follow us @SwayLang: ");
print_light_blue("https://twitter.com/SwayLang\n");
print_light_green("- Ask questions in dev-chat on Discord: ");
print_light_blue("https://discord.com/invite/xfpK4Pe\n\n");

print_light_blue("Report Bugs:\n");
print_light_green("- Sway Issues: ");
print_light_blue("https://github.com/FuelLabs/sway/issues/new\n");
}

pub fn init(command: InitCommand) -> Result<()> {
Expand Down Expand Up @@ -186,8 +180,8 @@ pub(crate) fn init_new_project(project_name: String, program_type: ProgramType)
defaults::default_gitignore(),
)?;

println_green(&format!(
"Successfully created {program_type}: {project_name}",
print_light_green(&format!(
"\nSuccessfully created {program_type}: {project_name}\n",
));

print_welcome_message();
Expand Down

0 comments on commit c2c952b

Please sign in to comment.