refactor: Use PathBuf for paths in flag parsing and whitelists (#3955)

* Use PathBuf for DenoSubcommand::Bundle's out_file
* Use PathBuf for DenoSubcommand::Format's files
* Use PathBuf for DenoSubcommand::Install's dir
* Use PathBuf for read/write whitelists
This commit is contained in:
Nayeem Rahman 2020-02-11 09:29:36 +00:00 committed by GitHub
parent 79b3bc05d6
commit 701ce9b334
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 69 additions and 67 deletions

View file

@ -72,6 +72,7 @@ use log::Level;
use log::Metadata;
use log::Record;
use std::env;
use std::path::PathBuf;
static LOGGER: Logger = Logger;
@ -258,7 +259,7 @@ async fn info_command(flags: DenoFlags, file: Option<String>) {
async fn install_command(
flags: DenoFlags,
dir: Option<String>,
dir: Option<PathBuf>,
exe_name: String,
module_url: String,
args: Vec<String>,
@ -331,7 +332,7 @@ async fn eval_command(flags: DenoFlags, code: String) {
async fn bundle_command(
flags: DenoFlags,
source_file: String,
out_file: Option<String>,
out_file: Option<PathBuf>,
) {
debug!(">>>>> bundle_async START");
let source_file_specifier =
@ -404,7 +405,7 @@ async fn run_script(flags: DenoFlags, script: String) {
js_check(worker.execute("window.dispatchEvent(new Event('unload'))"));
}
async fn fmt_command(files: Option<Vec<String>>, check: bool) {
async fn fmt_command(files: Option<Vec<PathBuf>>, check: bool) {
if let Err(err) = fmt::format_files(files, check) {
print_err_and_exit(err);
}