Skip to content

Commit

Permalink
move quote_args to macos
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfv committed Feb 27, 2025
1 parent ca159f7 commit e1e6888
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
14 changes: 12 additions & 2 deletions crates/rattler_menuinst/src/macos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,21 @@ use crate::{
CFBundleDocumentTypesModel, CFBundleTypeRole, CFBundleURLTypesModel, LSHandlerRank, MacOS,
MacOSVersion, MenuItemCommand, UTTypeDeclarationModel,
},
utils::{self, log_output, run_pre_create_command},
utils::{log_output, run_pre_create_command},
MenuInstError, MenuMode,
};
use std::collections::HashMap;

pub fn quote_args<I, S>(args: I) -> Vec<String>
where
I: IntoIterator<Item = S>,
S: AsRef<str>,
{
args.into_iter()
.map(|arg| format!(r#""{}""#, arg.as_ref()))
.collect()
}

#[derive(Debug, Clone)]
pub struct MacOSMenu {
name: String,
Expand Down Expand Up @@ -658,7 +668,7 @@ impl MacOSMenu {
.command
.iter()
.map(|s| s.resolve(&self.placeholders));
lines.push(utils::quote_args(command).join(" "));
lines.push(quote_args(command).join(" "));

Ok(lines.join("\n"))
}
Expand Down
10 changes: 0 additions & 10 deletions crates/rattler_menuinst/src/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,3 @@ pub use terminal::log_output;

#[cfg(target_family = "unix")]
pub use terminal::run_pre_create_command;

pub fn quote_args<I, S>(args: I) -> Vec<String>
where
I: IntoIterator<Item = S>,
S: AsRef<str>,
{
args.into_iter()
.map(|arg| format!(r#""{}""#, arg.as_ref()))
.collect()
}

0 comments on commit e1e6888

Please sign in to comment.