-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #409 from moonbitlang/moon-fmt-extra-args
Moon fmt extra args
- Loading branch information
Showing
8 changed files
with
90 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ | |
// | ||
// For inquiries, you can contact us via e-mail at [email protected]. | ||
|
||
use anyhow::bail; | ||
use moonbuild::dry_run; | ||
use mooncake::pkg::sync::auto_sync; | ||
use moonutil::{ | ||
common::{FileLock, FmtOpt, MoonbuildOpt, MooncOpt, RunMode}, | ||
|
@@ -36,6 +36,8 @@ pub struct FmtSubcommand { | |
/// Sort input files | ||
#[clap(long)] | ||
pub sort_input: bool, | ||
|
||
pub args: Vec<String>, | ||
} | ||
|
||
pub fn run_fmt(cli: &UniversalFlags, cmd: FmtSubcommand) -> anyhow::Result<i32> { | ||
|
@@ -64,7 +66,10 @@ pub fn run_fmt(cli: &UniversalFlags, cmd: FmtSubcommand) -> anyhow::Result<i32> | |
target_dir: target_dir.clone(), | ||
sort_input: cmd.sort_input, | ||
run_mode, | ||
fmt_opt: Some(FmtOpt { check: cmd.check }), | ||
fmt_opt: Some(FmtOpt { | ||
check: cmd.check, | ||
extra_args: cmd.args, | ||
}), | ||
build_graph: cli.build_graph, | ||
test_opt: None, | ||
args: vec![], | ||
|
@@ -83,7 +88,7 @@ pub fn run_fmt(cli: &UniversalFlags, cmd: FmtSubcommand) -> anyhow::Result<i32> | |
)?; | ||
|
||
if cli.dry_run { | ||
bail!("dry-run is not implemented for fmt"); | ||
return dry_run::print_commands(&module, &moonc_opt, &moonbuild_opt); | ||
} | ||
moonbuild::entry::run_fmt(&module, &moonc_opt, &moonbuild_opt) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,8 +16,6 @@ | |
// | ||
// For inquiries, you can contact us via e-mail at [email protected]. | ||
|
||
use std::path::PathBuf; | ||
|
||
pub mod embed; | ||
pub mod format_and_diff; | ||
|
||
|
@@ -36,14 +34,6 @@ pub enum ToolSubcommands { | |
Embed(Embed), | ||
} | ||
|
||
#[derive(Debug, clap::Parser)] | ||
pub struct FormatAndWriteSubcommand { | ||
#[clap(long)] | ||
old: PathBuf, | ||
#[clap(long)] | ||
new: PathBuf, | ||
} | ||
|
||
pub fn run_tool(cmd: ToolSubcommand) -> anyhow::Result<i32> { | ||
match cmd.subcommand { | ||
ToolSubcommands::FormatAndDiff(subcmd) => run_format_and_diff(subcmd), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters