Skip to content

Commit 3a551e9

Browse files
committed
Error out intentionally if no --all or path is provided.
1 parent 282694d commit 3a551e9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/cli/transpile.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use clap::{arg, ArgAction, ArgMatches, Command};
66
use itertools::Itertools;
77

88
use crate::cli::logging::{dump_failure, dump_start, dump_success};
9-
use crate::error::RResult;
9+
use crate::error::{RResult, RuntimeError};
1010
use crate::interpreter::runtime::Runtime;
1111
use crate::program::module::{module_name, Module};
1212
use crate::transpiler::LanguageContext;
@@ -46,7 +46,7 @@ pub fn run(args: &ArgMatches) -> RResult<ExitCode> {
4646

4747
let output_extensions: Vec<&str> = match should_output_all {
4848
true => vec!["py"],
49-
false => vec![output_path_proto.extension().and_then(OsStr::to_str).unwrap()]
49+
false => vec![output_path_proto.extension().and_then(OsStr::to_str).ok_or_else(|| vec![RuntimeError::error("Error: must provide either output path or --all")])?]
5050
};
5151

5252
let mut runtime = Runtime::new()?;

0 commit comments

Comments
 (0)