From ca58fb839012957b9addc947edd5110b6c3d1fda Mon Sep 17 00:00:00 2001 From: howardwu Date: Sat, 16 May 2020 19:52:44 -0700 Subject: [PATCH] Add skeleton for 'leo deploy' --- leo/commands/deploy.rs | 41 +++++++++++++++++++++++++++++++++++++++++ leo/commands/mod.rs | 3 +++ leo/main.rs | 2 ++ 3 files changed, 46 insertions(+) create mode 100644 leo/commands/deploy.rs diff --git a/leo/commands/deploy.rs b/leo/commands/deploy.rs new file mode 100644 index 0000000000..fe96ba0fcb --- /dev/null +++ b/leo/commands/deploy.rs @@ -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 { + Ok(()) + } + + #[cfg_attr(tarpaulin, skip)] + fn output(options: Self::Options) -> Result { + 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(()) + } +} diff --git a/leo/commands/mod.rs b/leo/commands/mod.rs index e0618e6c9a..c617fc812f 100644 --- a/leo/commands/mod.rs +++ b/leo/commands/mod.rs @@ -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::*; diff --git a/leo/main.rs b/leo/main.rs index d939e5b7a0..a5d56d515f 100644 --- a/leo/main.rs +++ b/leo/main.rs @@ -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!(), } }