Adds skeleton CLI for

This commit is contained in:
howardwu 2020-05-16 19:48:52 -07:00
parent fe1e83b50d
commit c58392ad1b
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!(),
}
}