diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2023-12-06 09:22:30 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-06 09:22:30 -0500 |
commit | 1ac370632fdac5b7bbab3a24045692d6b74551dd (patch) | |
tree | 18dd9c83e83d98b4639af1432d95d2c33940f636 /cli/main.rs | |
parent | 8c0fb9003d874fcbee0b1a6f6ee30dfb58c668bc (diff) |
fix: display unstable flags at bottom of help text (#21468)
Moves the unstable flags to be at the bottom of the help text. They were
previously all over the place for some reason.
Diffstat (limited to 'cli/main.rs')
-rw-r--r-- | cli/main.rs | 53 |
1 files changed, 36 insertions, 17 deletions
diff --git a/cli/main.rs b/cli/main.rs index bd29dc532..c95e5dc37 100644 --- a/cli/main.rs +++ b/cli/main.rs @@ -271,7 +271,7 @@ fn unwrap_or_exit<T>(result: Result<T, AnyError>) -> T { } } -// NOTE(bartlomieju): keep IDs in sync with `runtime/90_deno_ns.js`. +// NOTE(bartlomieju): keep IDs in sync with `runtime/90_deno_ns.js` (search for `unstableFeatures`) pub(crate) static UNSTABLE_GRANULAR_FLAGS: &[( // flag name &str, @@ -286,43 +286,45 @@ pub(crate) static UNSTABLE_GRANULAR_FLAGS: &[( 1, ), ( - deno_runtime::deno_ffi::UNSTABLE_FEATURE_NAME, - "Enable unstable FFI APIs", + deno_runtime::deno_cron::UNSTABLE_FEATURE_NAME, + "Enable unstable Deno.cron API", 2, ), ( - deno_runtime::deno_fs::UNSTABLE_FEATURE_NAME, - "Enable unstable file system APIs", + deno_runtime::deno_ffi::UNSTABLE_FEATURE_NAME, + "Enable unstable FFI APIs", 3, ), ( - deno_runtime::deno_kv::UNSTABLE_FEATURE_NAME, - "Enable unstable Key-Value store APIs", + deno_runtime::deno_fs::UNSTABLE_FEATURE_NAME, + "Enable unstable file system APIs", 4, ), ( - deno_runtime::deno_net::UNSTABLE_FEATURE_NAME, - "Enable unstable net APIs", + deno_runtime::ops::http::UNSTABLE_FEATURE_NAME, + "Enable unstable HTTP APIs", 5, ), ( - deno_runtime::ops::http::UNSTABLE_FEATURE_NAME, - "Enable unstable HTTP APIs", + deno_runtime::deno_kv::UNSTABLE_FEATURE_NAME, + "Enable unstable Key-Value store APIs", 6, ), ( - deno_runtime::ops::worker_host::UNSTABLE_FEATURE_NAME, - "Enable unstable Web Worker APIs", + deno_runtime::deno_net::UNSTABLE_FEATURE_NAME, + "Enable unstable net APIs", 7, ), ( - deno_runtime::deno_cron::UNSTABLE_FEATURE_NAME, - "Enable unstable Deno.cron API", + "unsafe-proto", + "Enable unsafe __proto__ support. This is a security risk.", + // This number is used directly in the JS code. Search + // for "unstableFeatures" to see where it's used. 8, ), ( - "unsafe-proto", - "Enable unsafe __proto__ support. This is a security risk.", + deno_runtime::ops::worker_host::UNSTABLE_FEATURE_NAME, + "Enable unstable Web Worker APIs", 9, ), ]; @@ -402,3 +404,20 @@ pub fn main() { std::process::exit(exit_code); } + +#[cfg(test)] +mod test { + use super::*; + + #[test] + fn unstable_granular_flag_names_sorted() { + let flags = UNSTABLE_GRANULAR_FLAGS + .iter() + .map(|(name, _, _)| name.to_string()) + .collect::<Vec<_>>(); + let mut sorted_flags = flags.clone(); + sorted_flags.sort(); + // sort the flags by name so they appear nicely in the help text + assert_eq!(flags, sorted_flags); + } +} |