summaryrefslogtreecommitdiff
path: root/cli/args/flags.rs
diff options
context:
space:
mode:
authorDivy Srivastava <dj.srivastava23@gmail.com>2024-08-14 21:42:23 -0700
committerGitHub <noreply@github.com>2024-08-15 10:12:23 +0530
commit7ca95fc999f22cb0eb312e02f8c40d7589b35b7e (patch)
tree9d4b27eb8f180aafba40c869db6acf20ea5f5423 /cli/args/flags.rs
parente92a05b5518e5fd30559c96c5990b08657bbc3e4 (diff)
feat: `deno compile --icon <ico>` (#25039)
Add `--icon` flag to set deno compile'd executable icon on Windows. ``` deno compile --icon icon.ico game.tsx ``` Depends on https://github.com/denoland/sui/pull/24 <img width="447" alt="image" src="https://github.com/user-attachments/assets/7f6f3aa0-6872-4975-ae9d-06701b7684b8"> Closes https://github.com/denoland/deno/issues/8912
Diffstat (limited to 'cli/args/flags.rs')
-rw-r--r--cli/args/flags.rs13
1 files changed, 12 insertions, 1 deletions
diff --git a/cli/args/flags.rs b/cli/args/flags.rs
index 800d6ff5a..266907b13 100644
--- a/cli/args/flags.rs
+++ b/cli/args/flags.rs
@@ -121,6 +121,7 @@ pub struct CompileFlags {
pub args: Vec<String>,
pub target: Option<String>,
pub no_terminal: bool,
+ pub icon: Option<String>,
pub include: Vec<String>,
}
@@ -1769,6 +1770,12 @@ supported in canary.
.help("Hide terminal on Windows")
.action(ArgAction::SetTrue),
)
+ .arg(
+ Arg::new("icon")
+ .long("icon")
+ .help("Set the icon of the executable on Windows (.ico)")
+ .value_parser(value_parser!(String))
+ )
.arg(executable_ext_arg())
.arg(env_file_arg())
.arg(script_arg().required(true).trailing_var_arg(true))
@@ -3891,6 +3898,7 @@ fn compile_parse(flags: &mut Flags, matches: &mut ArgMatches) {
let args = script.collect();
let output = matches.remove_one::<String>("output");
let target = matches.remove_one::<String>("target");
+ let icon = matches.remove_one::<String>("icon");
let no_terminal = matches.get_flag("no-terminal");
let include = match matches.remove_many::<String>("include") {
Some(f) => f.collect(),
@@ -3904,6 +3912,7 @@ fn compile_parse(flags: &mut Flags, matches: &mut ArgMatches) {
args,
target,
no_terminal,
+ icon,
include,
});
}
@@ -9554,6 +9563,7 @@ mod tests {
args: vec![],
target: None,
no_terminal: false,
+ icon: None,
include: vec![]
}),
type_check_mode: TypeCheckMode::Local,
@@ -9565,7 +9575,7 @@ mod tests {
#[test]
fn compile_with_flags() {
#[rustfmt::skip]
- let r = flags_from_vec(svec!["deno", "compile", "--import-map", "import_map.json", "--no-remote", "--config", "tsconfig.json", "--no-check", "--unsafely-ignore-certificate-errors", "--reload", "--lock", "lock.json", "--lock-write", "--cert", "example.crt", "--cached-only", "--location", "https:foo", "--allow-read", "--allow-net", "--v8-flags=--help", "--seed", "1", "--no-terminal", "--output", "colors", "--env=.example.env", "https://examples.deno.land/color-logging.ts", "foo", "bar", "-p", "8080"]);
+ let r = flags_from_vec(svec!["deno", "compile", "--import-map", "import_map.json", "--no-remote", "--config", "tsconfig.json", "--no-check", "--unsafely-ignore-certificate-errors", "--reload", "--lock", "lock.json", "--lock-write", "--cert", "example.crt", "--cached-only", "--location", "https:foo", "--allow-read", "--allow-net", "--v8-flags=--help", "--seed", "1", "--no-terminal", "--icon", "favicon.ico", "--output", "colors", "--env=.example.env", "https://examples.deno.land/color-logging.ts", "foo", "bar", "-p", "8080"]);
assert_eq!(
r.unwrap(),
Flags {
@@ -9576,6 +9586,7 @@ mod tests {
args: svec!["foo", "bar", "-p", "8080"],
target: None,
no_terminal: true,
+ icon: Some(String::from("favicon.ico")),
include: vec![]
}),
import_map_path: Some("import_map.json".to_string()),