Change subcommand name from Compile to Build
This commit is contained in:
parent
54e536d11f
commit
fd20fec53c
12
src/cli.rs
12
src/cli.rs
|
@ -1,6 +1,6 @@
|
|||
use crate::{
|
||||
error::Result,
|
||||
subcommands::{self, CompileArgs, InitArgs},
|
||||
subcommands::{self, BuildArgs, InitArgs},
|
||||
};
|
||||
use clap::{Parser, Subcommand};
|
||||
|
||||
|
@ -18,13 +18,13 @@ pub struct Args {
|
|||
pub enum Command {
|
||||
/// Initialize a new project.
|
||||
Init(InitArgs),
|
||||
/// Compile the project.
|
||||
Compile(CompileArgs),
|
||||
/// Build the project.
|
||||
Build(BuildArgs),
|
||||
#[cfg(feature = "zip")]
|
||||
/// Compile and package the project.
|
||||
/// Build and package the project.
|
||||
Package(subcommands::PackageArgs),
|
||||
#[cfg(feature = "lang-debug")]
|
||||
/// Compile the project and dump the intermediate state.
|
||||
/// Build the project and dump the intermediate state.
|
||||
LangDebug(subcommands::LangDebugArgs),
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ impl Args {
|
|||
pub fn run(&self) -> Result<()> {
|
||||
match &self.cmd {
|
||||
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")]
|
||||
Command::Package(args) => subcommands::package(self.verbose, args)?,
|
||||
#[cfg(feature = "lang-debug")]
|
||||
|
|
|
@ -8,17 +8,17 @@ use std::{fs, path::PathBuf};
|
|||
use crate::util;
|
||||
|
||||
#[derive(Debug, clap::Args, Clone)]
|
||||
pub struct CompileArgs {
|
||||
/// The path of the project to compile.
|
||||
pub struct BuildArgs {
|
||||
/// The path of the project to build.
|
||||
#[clap(default_value = ".")]
|
||||
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 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() {
|
||||
print_error("The specified path does not exist.");
|
||||
|
@ -60,7 +60,7 @@ pub fn compile(_verbose: bool, args: &CompileArgs) -> Result<()> {
|
|||
compiled.place(&dist_path)?;
|
||||
|
||||
print_info(&format!(
|
||||
"Finished compiling project to {}",
|
||||
"Finished building project to {}",
|
||||
util::to_absolute_path(&dist_path)?
|
||||
));
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
mod init;
|
||||
pub use init::{init, InitArgs};
|
||||
|
||||
mod compile;
|
||||
pub use compile::{compile, CompileArgs};
|
||||
mod build;
|
||||
pub use build::{build, BuildArgs};
|
||||
|
||||
#[cfg(feature = "zip")]
|
||||
mod package;
|
||||
|
|
Loading…
Reference in New Issue