Skip to content

Commit

Permalink
Modified 'new' CLI command to error out when given too many arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
IsaacShelton committed Dec 9, 2024
1 parent 11ae60f commit 1507a42
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/cli/new/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ use super::NewCommand;

impl NewCommand {
pub fn parse(mut args: impl Iterator<Item = String>) -> Result<Self, ()> {
// Skip over 'new' command keyword
args.next().unwrap();
args.next().expect("skip over 'new' command keyword");

let Some(project_name) = args.next() else {
let (Some(project_name), None) = (args.next(), args.next()) else {
println!("adept new <PROJECT_NAME>");
return Err(());
};
Expand Down

0 comments on commit 1507a42

Please sign in to comment.