Change subcommand name from Compile to Build

This commit is contained in:
Moritz Hölting 2024-04-02 22:20:15 +02:00
parent 54e536d11f
commit fd20fec53c
3 changed files with 13 additions and 13 deletions

View File

@ -1,6 +1,6 @@
use crate::{ use crate::{
error::Result, error::Result,
subcommands::{self, CompileArgs, InitArgs}, subcommands::{self, BuildArgs, InitArgs},
}; };
use clap::{Parser, Subcommand}; use clap::{Parser, Subcommand};
@ -18,13 +18,13 @@ pub struct Args {
pub enum Command { pub enum Command {
/// Initialize a new project. /// Initialize a new project.
Init(InitArgs), Init(InitArgs),
/// Compile the project. /// Build the project.
Compile(CompileArgs), Build(BuildArgs),
#[cfg(feature = "zip")] #[cfg(feature = "zip")]
/// Compile and package the project. /// Build and package the project.
Package(subcommands::PackageArgs), Package(subcommands::PackageArgs),
#[cfg(feature = "lang-debug")] #[cfg(feature = "lang-debug")]
/// Compile the project and dump the intermediate state. /// Build the project and dump the intermediate state.
LangDebug(subcommands::LangDebugArgs), LangDebug(subcommands::LangDebugArgs),
} }
@ -32,7 +32,7 @@ impl Args {
pub fn run(&self) -> Result<()> { pub fn run(&self) -> Result<()> {
match &self.cmd { match &self.cmd {
Command::Init(args) => subcommands::init(self.verbose, args)?, Command::Init(args) => subcommands::init(self.verbose, args)?,
Command::Compile(args) => subcommands::compile(self.verbose, args)?, Command::Build(args) => subcommands::build(self.verbose, args)?,
#[cfg(feature = "zip")] #[cfg(feature = "zip")]
Command::Package(args) => subcommands::package(self.verbose, args)?, Command::Package(args) => subcommands::package(self.verbose, args)?,
#[cfg(feature = "lang-debug")] #[cfg(feature = "lang-debug")]

View File

@ -8,17 +8,17 @@ use std::{fs, path::PathBuf};
use crate::util; use crate::util;
#[derive(Debug, clap::Args, Clone)] #[derive(Debug, clap::Args, Clone)]
pub struct CompileArgs { pub struct BuildArgs {
/// The path of the project to compile. /// The path of the project to build.
#[clap(default_value = ".")] #[clap(default_value = ".")]
path: PathBuf, path: PathBuf,
} }
pub fn compile(_verbose: bool, args: &CompileArgs) -> Result<()> { pub fn build(_verbose: bool, args: &BuildArgs) -> Result<()> {
let path = args.path.as_path(); let path = args.path.as_path();
let str_path = util::to_absolute_path(path)?; let str_path = util::to_absolute_path(path)?;
print_info(&format!("Compiling project at {}", str_path)); print_info(&format!("Building project at {}", str_path));
let toml_path = if !path.exists() { let toml_path = if !path.exists() {
print_error("The specified path does not exist."); print_error("The specified path does not exist.");
@ -60,7 +60,7 @@ pub fn compile(_verbose: bool, args: &CompileArgs) -> Result<()> {
compiled.place(&dist_path)?; compiled.place(&dist_path)?;
print_info(&format!( print_info(&format!(
"Finished compiling project to {}", "Finished building project to {}",
util::to_absolute_path(&dist_path)? util::to_absolute_path(&dist_path)?
)); ));

View File

@ -1,8 +1,8 @@
mod init; mod init;
pub use init::{init, InitArgs}; pub use init::{init, InitArgs};
mod compile; mod build;
pub use compile::{compile, CompileArgs}; pub use build::{build, BuildArgs};
#[cfg(feature = "zip")] #[cfg(feature = "zip")]
mod package; mod package;