snarkvm_debug/cli/commands/clean.rs
1// Copyright (C) 2019-2023 Aleo Systems Inc.
2// This file is part of the snarkVM library.
3
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at:
7// http://www.apache.org/licenses/LICENSE-2.0
8
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15use super::*;
16
17/// Cleans the Aleo package build directory.
18#[derive(Debug, Parser)]
19pub struct Clean;
20
21impl Clean {
22 /// Cleans an Aleo package build directory.
23 pub fn parse(self) -> Result<String> {
24 // Derive the program directory path.
25 let path = std::env::current_dir()?;
26
27 // Clean the build directory.
28 Package::<CurrentNetwork>::clean(&path)?;
29
30 // Prepare the path string.
31 let path_string = format!("(in \"{}\")", path.join("build").display());
32
33 Ok(format!("✅ Cleaned the build directory {}", path_string.dimmed()))
34 }
35}