Merge pull request #13 from AleoHQ/skeleton/cli

Adds skeleton CLI for `leo publish`
This commit is contained in:
Howard Wu 2020-05-16 19:49:51 -07:00 committed by GitHub
commit 730b3f8c58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 46 additions and 0 deletions

View File

@ -10,6 +10,9 @@ pub use self::new::*;
pub mod prove;
pub use self::prove::*;
pub mod publish;
pub use self::publish::*;
pub mod run;
pub use self::run::*;

41
leo/commands/publish.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 PublishCommand;
impl CLI for PublishCommand {
type Options = ();
type Output = ();
const NAME: NameType = "publish";
const ABOUT: AboutType = "Package circuit and upload this package to the registry";
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 publish`");
Ok(())
}
}

View File

@ -25,6 +25,7 @@ fn main() -> Result<(), CLIError> {
SetupCommand::new(),
ProveCommand::new(),
RunCommand::new(),
PublishCommand::new(),
])
.set_term_width(0)
.get_matches();
@ -45,6 +46,7 @@ fn main() -> Result<(), CLIError> {
Ok(())
}
("run", Some(arguments)) => RunCommand::output(RunCommand::parse(arguments)?),
("publish", Some(arguments)) => PublishCommand::output(PublishCommand::parse(arguments)?),
_ => unreachable!(),
}
}