Skip to content

Commit

Permalink
Filename fixes
Browse files Browse the repository at this point in the history
The previous PR wasn't rebased, so it failed to compile, this PR fixes
it.
  • Loading branch information
certik committed Jan 29, 2025
1 parent b9ad359 commit 58be47d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions crates/shell/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,13 @@ async fn main() -> miette::Result<()> {

if options.file.is_some() || options.command.is_some() {
let script_text;
let filename: Option<String>;
if options.file.is_some() {
script_text = std::fs::read_to_string(options.file.unwrap()).unwrap();
script_text = std::fs::read_to_string(options.file.clone().unwrap()).unwrap();
filename = Some(options.file.unwrap().display().to_string());
} else if options.command.is_some() {
script_text = options.command.unwrap();
filename = None;
} else {
panic!();
}
Expand All @@ -198,7 +201,7 @@ async fn main() -> miette::Result<()> {
debug_parse(&script_text);
return Ok(());
}
let exit_code = execute(&script_text, Some(file.display().to_string()), &mut state).await?;
let exit_code = execute(&script_text, filename, &mut state).await?;
if options.interact {
interactive(Some(state), options.norc).await?;
}
Expand Down

0 comments on commit 58be47d

Please sign in to comment.