added format command

This commit is contained in:
JOLIMAITRE Matthieu 2022-09-25 23:15:35 +02:00
parent e7433e42db
commit b6962301ea
2 changed files with 23 additions and 2 deletions

View file

@ -18,12 +18,18 @@ pub struct Arguments {
#[allow(non_camel_case_types)]
#[derive(Subcommand)]
pub enum Commands {
/// Checks a source file for conformance with piscine limitations.
/// Checks source files for conformance with piscine limitations.
check {
/// File to check.
files: Vec<String>,
},
/// Formats source files.
format {
/// Files to format.
files: Vec<String>,
},
/// Runs a set of files or the default target.
run {
/// Files to run.
@ -82,6 +88,9 @@ fn main() {
match args.command {
Commands::check { files } => check::main(files),
Commands::format { files } => check::format(files),
Commands::run { mut files } => {
if files.is_empty() {
files.push(Config::get_current().main_file().to_string());
@ -90,6 +99,7 @@ fn main() {
let args = compilation_args();
run::main(files, args);
}
Commands::test {
capture,
mut files,