change config module to generate

This commit is contained in:
Alfredo Garcia 2020-06-18 15:38:46 -03:00 committed by Henry de Valence
parent 70948556cf
commit b8f174ee3a
2 changed files with 8 additions and 8 deletions

View File

@ -1,14 +1,14 @@
//! Zebrad Subcommands //! Zebrad Subcommands
mod config;
mod connect; mod connect;
mod generate;
mod revhex; mod revhex;
mod seed; mod seed;
mod start; mod start;
mod version; mod version;
use self::{ use self::{
config::ConfigCmd, connect::ConnectCmd, revhex::RevhexCmd, seed::SeedCmd, start::StartCmd, connect::ConnectCmd, generate::GenerateCmd, revhex::RevhexCmd, seed::SeedCmd, start::StartCmd,
version::VersionCmd, version::VersionCmd,
}; };
use crate::config::ZebradConfig; use crate::config::ZebradConfig;
@ -23,9 +23,9 @@ pub const CONFIG_FILE: &str = "zebrad.toml";
/// Zebrad Subcommands /// Zebrad Subcommands
#[derive(Command, Debug, Options, Runnable)] #[derive(Command, Debug, Options, Runnable)]
pub enum ZebradCmd { pub enum ZebradCmd {
/// The `config` subcommand /// The `generate` subcommand
#[options(help = "generate a skeleton configuration")] #[options(help = "generate a skeleton configuration")]
Config(ConfigCmd), Generate(GenerateCmd),
/// The `connect` subcommand /// The `connect` subcommand
#[options(help = "testing stub for dumping network messages")] #[options(help = "testing stub for dumping network messages")]

View File

@ -1,17 +1,17 @@
//! `config` subcommand - generates a skeleton config. //! `generate` subcommand - generates a skeleton config.
use crate::config::ZebradConfig; use crate::config::ZebradConfig;
use abscissa_core::{Command, Options, Runnable}; use abscissa_core::{Command, Options, Runnable};
/// `config` subcommand /// `generate` subcommand
#[derive(Command, Debug, Options)] #[derive(Command, Debug, Options)]
pub struct ConfigCmd { pub struct GenerateCmd {
/// The file to write the generated config to. /// The file to write the generated config to.
#[options(help = "The file to write the generated config to (stdout if unspecified)")] #[options(help = "The file to write the generated config to (stdout if unspecified)")]
output_file: Option<String>, output_file: Option<String>,
} }
impl Runnable for ConfigCmd { impl Runnable for GenerateCmd {
/// Start the application. /// Start the application.
fn run(&self) { fn run(&self) {
let default_config = ZebradConfig { let default_config = ZebradConfig {