summaryrefslogtreecommitdiff
path: root/cli/args
diff options
context:
space:
mode:
authorBartek Iwańczuk <biwanczuk@gmail.com>2024-11-20 00:18:57 +0100
committerBartek Iwańczuk <biwanczuk@gmail.com>2024-11-20 00:18:57 +0100
commit21bd818f1ee531a49c46213417774fbc18a8b562 (patch)
treeea32c744f0fd1932f7a505892e43846a73823fbd /cli/args
parent6356329b37282178701c0064a4a2cd04286a51e7 (diff)
parent46b6037644c761369e689704f8e7b857959da155 (diff)
Merge branch 'main' into haturatu/main
Diffstat (limited to 'cli/args')
-rw-r--r--cli/args/flags.rs33
-rw-r--r--cli/args/mod.rs4
2 files changed, 32 insertions, 5 deletions
diff --git a/cli/args/flags.rs b/cli/args/flags.rs
index 39db12b5f..85b8abefe 100644
--- a/cli/args/flags.rs
+++ b/cli/args/flags.rs
@@ -210,6 +210,7 @@ pub struct FmtFlags {
pub no_semicolons: Option<bool>,
pub watch: Option<WatchFlags>,
pub unstable_component: bool,
+ pub unstable_sql: bool,
}
impl FmtFlags {
@@ -1908,10 +1909,10 @@ On the first invocation with deno will download the proper binary and cache it i
Arg::new("include")
.long("include")
.help(
- cstr!("Includes an additional module in the compiled executable's module graph.
+ cstr!("Includes an additional module or local data file in the compiled executable.
<p(245)>Use this flag if a dynamically imported module or a web worker main module
- fails to load in the executable. This flag can be passed multiple times,
- to include multiple additional modules.</>",
+ fails to load in the executable or to embed a file in the executable. This flag can
+ be passed multiple times, to include multiple additional modules.</>",
))
.action(ArgAction::Append)
.value_hint(ValueHint::FilePath)
@@ -2291,7 +2292,7 @@ Ignore formatting a file by adding an ignore comment at the top of the file:
.value_parser([
"ts", "tsx", "js", "jsx", "md", "json", "jsonc", "css", "scss",
"sass", "less", "html", "svelte", "vue", "astro", "yml", "yaml",
- "ipynb",
+ "ipynb", "sql"
])
.help_heading(FMT_HEADING).requires("files"),
)
@@ -2410,6 +2411,14 @@ Ignore formatting a file by adding an ignore comment at the top of the file:
.help_heading(FMT_HEADING)
.hide(true),
)
+ .arg(
+ Arg::new("unstable-sql")
+ .long("unstable-sql")
+ .help("Enable formatting SQL files.")
+ .value_parser(FalseyValueParser::new())
+ .action(ArgAction::SetTrue)
+ .help_heading(FMT_HEADING),
+ )
})
}
@@ -4634,6 +4643,7 @@ fn fmt_parse(
let prose_wrap = matches.remove_one::<String>("prose-wrap");
let no_semicolons = matches.remove_one::<bool>("no-semicolons");
let unstable_component = matches.get_flag("unstable-component");
+ let unstable_sql = matches.get_flag("unstable-sql");
flags.subcommand = DenoSubcommand::Fmt(FmtFlags {
check: matches.get_flag("check"),
@@ -4646,6 +4656,7 @@ fn fmt_parse(
no_semicolons,
watch: watch_arg_parse(matches)?,
unstable_component,
+ unstable_sql,
});
Ok(())
}
@@ -6565,6 +6576,7 @@ mod tests {
prose_wrap: None,
no_semicolons: None,
unstable_component: false,
+ unstable_sql: false,
watch: Default::default(),
}),
..Flags::default()
@@ -6588,6 +6600,7 @@ mod tests {
prose_wrap: None,
no_semicolons: None,
unstable_component: false,
+ unstable_sql: false,
watch: Default::default(),
}),
..Flags::default()
@@ -6611,6 +6624,7 @@ mod tests {
prose_wrap: None,
no_semicolons: None,
unstable_component: false,
+ unstable_sql: false,
watch: Default::default(),
}),
..Flags::default()
@@ -6634,6 +6648,7 @@ mod tests {
prose_wrap: None,
no_semicolons: None,
unstable_component: false,
+ unstable_sql: false,
watch: Some(Default::default()),
}),
..Flags::default()
@@ -6648,7 +6663,8 @@ mod tests {
"--unstable-css",
"--unstable-html",
"--unstable-component",
- "--unstable-yaml"
+ "--unstable-yaml",
+ "--unstable-sql"
]);
assert_eq!(
r.unwrap(),
@@ -6666,6 +6682,7 @@ mod tests {
prose_wrap: None,
no_semicolons: None,
unstable_component: true,
+ unstable_sql: true,
watch: Some(WatchFlags {
hmr: false,
no_clear_screen: true,
@@ -6700,6 +6717,7 @@ mod tests {
prose_wrap: None,
no_semicolons: None,
unstable_component: false,
+ unstable_sql: false,
watch: Some(Default::default()),
}),
..Flags::default()
@@ -6723,6 +6741,7 @@ mod tests {
prose_wrap: None,
no_semicolons: None,
unstable_component: false,
+ unstable_sql: false,
watch: Default::default(),
}),
config_flag: ConfigFlag::Path("deno.jsonc".to_string()),
@@ -6754,6 +6773,7 @@ mod tests {
prose_wrap: None,
no_semicolons: None,
unstable_component: false,
+ unstable_sql: false,
watch: Some(Default::default()),
}),
config_flag: ConfigFlag::Path("deno.jsonc".to_string()),
@@ -6790,6 +6810,7 @@ mod tests {
prose_wrap: Some("never".to_string()),
no_semicolons: Some(true),
unstable_component: false,
+ unstable_sql: false,
watch: Default::default(),
}),
..Flags::default()
@@ -6820,6 +6841,7 @@ mod tests {
prose_wrap: None,
no_semicolons: Some(false),
unstable_component: false,
+ unstable_sql: false,
watch: Default::default(),
}),
..Flags::default()
@@ -6845,6 +6867,7 @@ mod tests {
prose_wrap: None,
no_semicolons: None,
unstable_component: false,
+ unstable_sql: false,
watch: Default::default(),
}),
ext: Some("html".to_string()),
diff --git a/cli/args/mod.rs b/cli/args/mod.rs
index ec75d7a10..61e1443a7 100644
--- a/cli/args/mod.rs
+++ b/cli/args/mod.rs
@@ -289,6 +289,7 @@ impl BenchOptions {
#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)]
pub struct UnstableFmtOptions {
pub component: bool,
+ pub sql: bool,
}
#[derive(Clone, Debug)]
@@ -322,6 +323,7 @@ impl FmtOptions {
options: resolve_fmt_options(fmt_flags, fmt_config.options),
unstable: UnstableFmtOptions {
component: unstable.component || fmt_flags.unstable_component,
+ sql: unstable.sql || fmt_flags.unstable_sql,
},
files: fmt_config.files,
}
@@ -1319,6 +1321,7 @@ impl CliOptions {
let workspace = self.workspace();
UnstableFmtOptions {
component: workspace.has_unstable("fmt-component"),
+ sql: workspace.has_unstable("fmt-sql"),
}
}
@@ -1667,6 +1670,7 @@ impl CliOptions {
"byonm",
"bare-node-builtins",
"fmt-component",
+ "fmt-sql",
])
.collect();