Skip to content

Commit

Permalink
Create skeleton for fmt command
Browse files Browse the repository at this point in the history
  • Loading branch information
d0cd committed Sep 4, 2024
1 parent 73632ba commit 36600c8
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 5 deletions.
16 changes: 11 additions & 5 deletions leo/cli/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ pub struct CLI {
pub home: Option<PathBuf>,
}

///Leo compiler and package manager
///The Leo CLI commands
#[derive(Parser, Debug)]
enum Commands {
#[clap(about = "Create a new Aleo account, sign and verify messages")]
Account {
#[clap(subcommand)]
command: Account,
},
#[clap(about = "Create a new Leo package in a new directory")]
#[clap(about = "Create a new Leo project in a new directory")]
New {
#[clap(flatten)]
command: New,
Expand All @@ -57,6 +57,11 @@ enum Commands {
#[clap(flatten)]
command: Example,
},
#[clap(about = "Format the current Leo project", name = "fmt")]
Format {
#[clap(flatten)]
command: Format,
},
#[clap(about = "Run a program with input variables")]
Run {
#[clap(flatten)]
Expand All @@ -77,17 +82,17 @@ enum Commands {
#[clap(flatten)]
command: Query,
},
#[clap(about = "Compile the current package as a program")]
#[clap(about = "Compile the current project")]
Build {
#[clap(flatten)]
command: Build,
},
#[clap(about = "Add a new on-chain or local dependency to the current package.")]
#[clap(about = "Add a new on-chain or local dependency to the current project.")]
Add {
#[clap(flatten)]
command: Add,
},
#[clap(about = "Remove a dependency from the current package.")]
#[clap(about = "Remove a dependency from the current project.")]
Remove {
#[clap(flatten)]
command: Remove,
Expand Down Expand Up @@ -137,6 +142,7 @@ pub fn run_with_args(cli: CLI) -> Result<()> {
Commands::Clean { command } => command.try_execute(context),
Commands::Deploy { command } => command.try_execute(context),
Commands::Example { command } => command.try_execute(context),
Commands::Format { command } => command.try_execute(context),
Commands::Run { command } => command.try_execute(context),
Commands::Execute { command } => command.try_execute(context),
Commands::Remove { command } => command.try_execute(context),
Expand Down
38 changes: 38 additions & 0 deletions leo/cli/commands/format.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Copyright (C) 2019-2023 Aleo Systems Inc.
// This file is part of the Leo library.

// The Leo library is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// The Leo library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.

use super::*;

/// Clean outputs folder command
#[derive(Parser, Debug)]
pub struct Format {}

impl Command for Format {
type Input = ();
type Output = ();

fn log_span(&self) -> Span {
tracing::span!(tracing::Level::INFO, "Leo")
}

fn prelude(&self, _: Context) -> Result<Self::Input> {
Ok(())
}

fn apply(self, _: Context, _: Self::Input) -> Result<Self::Output> {
todo!()
}
}
3 changes: 3 additions & 0 deletions leo/cli/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ pub use example::Example;
pub mod execute;
pub use execute::Execute;

pub mod format;
pub use format::Format;

pub mod query;
pub use query::Query;

Expand Down

0 comments on commit 36600c8

Please sign in to comment.