summaryrefslogtreecommitdiff
path: root/cli/lib.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2020-01-30 03:16:48 +0100
committerGitHub <noreply@github.com>2020-01-29 21:16:48 -0500
commit73a3cc21d0e7ceec1275078db125f57ce97725fb (patch)
tree17d845d5d125d3ba8ecefa49e57e02e9c088c68b /cli/lib.rs
parentf0a6062012c4e09553877c9feedb3fbc3d4625b9 (diff)
feat: dprint formatter (#3820)
* rewrite fmt_test in Rust, remove tools/fmt_test.py * remove //std/prettier
Diffstat (limited to 'cli/lib.rs')
-rw-r--r--cli/lib.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/cli/lib.rs b/cli/lib.rs
index 56705289f..fe20cd135 100644
--- a/cli/lib.rs
+++ b/cli/lib.rs
@@ -28,6 +28,7 @@ pub mod diagnostics;
mod disk_cache;
mod file_fetcher;
pub mod flags;
+mod fmt;
pub mod fmt_errors;
mod fs;
mod global_state;
@@ -422,6 +423,10 @@ fn run_script(flags: DenoFlags) {
}
}
+fn format_command(files: Option<Vec<String>>, check: bool) {
+ fmt::format_files(files, check);
+}
+
pub fn main() {
#[cfg(windows)]
ansi_term::enable_ansi_support().ok(); // For Windows 10
@@ -442,11 +447,12 @@ pub fn main() {
};
log::set_max_level(log_level.to_level_filter());
- match flags.subcommand {
+ match flags.clone().subcommand {
DenoSubcommand::Bundle => bundle_command(flags),
DenoSubcommand::Completions => {}
DenoSubcommand::Eval => eval_command(flags),
DenoSubcommand::Fetch => fetch_command(flags),
+ DenoSubcommand::Format { check, files } => format_command(files, check),
DenoSubcommand::Info => info_command(flags),
DenoSubcommand::Repl => run_repl(flags),
DenoSubcommand::Run => run_script(flags),