Skip to content

Commit

Permalink
Move the help string to a separate file
Browse files Browse the repository at this point in the history
Rather than having a bunch of oddly formatted strings for the help
message, we now can include it via `include_str` and have the message
reside in it's own help.txt file
  • Loading branch information
mgattozzi committed Jul 31, 2023
1 parent 565fbd3 commit 771f17e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
8 changes: 8 additions & 0 deletions src/help.txt
@@ -0,0 +1,8 @@
Alternative for Cargo

Usage: freight [COMMAND] [OPTIONS]

Commands:
build Build a Freight or Cargo project
test Test a Freight or Cargo project
help Print out this message
9 changes: 1 addition & 8 deletions src/main.rs
Expand Up @@ -3,14 +3,7 @@ use std::error::Error;
use std::process;

fn main() -> Result<(), Box<dyn Error>> {
const HELP: &str = "\
Alternative for Cargo\n\n\
Usage: freight [COMMAND] [OPTIONS]\n\n\
Commands:\n \
build Build a Freight or Cargo project\n \
test Test a Freight or Cargo project\n \
help Print out this message
";
const HELP: &str = include_str!("help.txt");

let mut args = env::args().skip(1);
match args.next().as_ref().map(String::as_str) {
Expand Down

0 comments on commit 771f17e

Please sign in to comment.