Merge pull request #14 from AleoHQ/skeleton/cli

Adds skeleton CLI for `leo deploy`
This commit is contained in:
Howard Wu 2020-05-16 19:58:17 -07:00 committed by GitHub
commit 9d67019cac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 47 additions and 1 deletions

41
leo/commands/deploy.rs Normal file
View File

@ -0,0 +1,41 @@
use crate::{cli::*, cli_types::*};
use crate::commands::BuildCommand;
use crate::errors::CLIError;
use crate::files::Manifest;
use clap::ArgMatches;
use std::convert::TryFrom;
use std::env::current_dir;
#[derive(Debug)]
pub struct DeployCommand;
impl CLI for DeployCommand {
type Options = ();
type Output = ();
const NAME: NameType = "deploy";
const ABOUT: AboutType = "Deploy package as program to the network (*)";
const ARGUMENTS: &'static [ArgumentType] = &[];
const FLAGS: &'static [FlagType] = &[];
const OPTIONS: &'static [OptionType] = &[];
const SUBCOMMANDS: &'static [SubCommandType] = &[];
#[cfg_attr(tarpaulin, skip)]
fn parse(_arguments: &ArgMatches) -> Result<Self::Options, CLIError> {
Ok(())
}
#[cfg_attr(tarpaulin, skip)]
fn output(options: Self::Options) -> Result<Self::Output, CLIError> {
let (_program, _checksum_differs) = BuildCommand::output(options)?;
// Get the package name
let path = current_dir()?;
let _package_name = Manifest::try_from(&path)?.get_package_name();
log::info!("Unimplemented - `leo deploy`");
Ok(())
}
}

View File

@ -1,6 +1,9 @@
pub mod build;
pub use self::build::*;
pub mod deploy;
pub use self::deploy::*;
pub mod init;
pub use self::init::*;

View File

@ -15,7 +15,7 @@ impl CLI for PublishCommand {
type Output = ();
const NAME: NameType = "publish";
const ABOUT: AboutType = "Package circuit and upload this package to the registry";
const ABOUT: AboutType = "Package circuit and upload this package to the registry (*)";
const ARGUMENTS: &'static [ArgumentType] = &[];
const FLAGS: &'static [FlagType] = &[];
const OPTIONS: &'static [OptionType] = &[];

View File

@ -26,6 +26,7 @@ fn main() -> Result<(), CLIError> {
ProveCommand::new(),
RunCommand::new(),
PublishCommand::new(),
DeployCommand::new(),
])
.set_term_width(0)
.get_matches();
@ -47,6 +48,7 @@ fn main() -> Result<(), CLIError> {
}
("run", Some(arguments)) => RunCommand::output(RunCommand::parse(arguments)?),
("publish", Some(arguments)) => PublishCommand::output(PublishCommand::parse(arguments)?),
("deploy", Some(arguments)) => DeployCommand::output(DeployCommand::parse(arguments)?),
_ => unreachable!(),
}
}