-
-
Notifications
You must be signed in to change notification settings - Fork 561
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(rust): revert command features
- Loading branch information
1 parent
ae36b80
commit b80f016
Showing
8 changed files
with
104 additions
and
257 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 11 additions & 17 deletions
28
implementations/rust/ockam/ockam_command/src/kafka/mod.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 30 additions & 34 deletions
64
implementations/rust/ockam/ockam_command/src/service/mod.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,40 @@ | ||
pub(crate) mod config; | ||
|
||
cfg_if::cfg_if! { | ||
if #[cfg(feature = "advanced_commands")] { | ||
pub(crate) mod list; | ||
pub(crate) mod start; | ||
pub(crate) mod list; | ||
pub(crate) mod start; | ||
|
||
use clap::{Args, Subcommand}; | ||
use list::ListCommand; | ||
pub(crate) use start::StartCommand; | ||
use crate::{docs, CommandGlobalOpts}; | ||
use crate::{docs, CommandGlobalOpts}; | ||
use clap::{Args, Subcommand}; | ||
use list::ListCommand; | ||
pub(crate) use start::StartCommand; | ||
|
||
#[derive(Clone, Debug, Args)] | ||
#[command(hide = docs::hide())] | ||
pub struct ServiceCommand { | ||
#[command(subcommand)] | ||
subcommand: ServiceSubcommand, | ||
} | ||
#[derive(Clone, Debug, Args)] | ||
#[command(hide = docs::hide())] | ||
pub struct ServiceCommand { | ||
#[command(subcommand)] | ||
subcommand: ServiceSubcommand, | ||
} | ||
|
||
#[derive(Clone, Debug, Subcommand)] | ||
pub enum ServiceSubcommand { | ||
#[command(display_order = 900)] | ||
Start(StartCommand), | ||
#[command(display_order = 901)] | ||
List(ListCommand), | ||
} | ||
#[derive(Clone, Debug, Subcommand)] | ||
pub enum ServiceSubcommand { | ||
#[command(display_order = 900)] | ||
Start(StartCommand), | ||
#[command(display_order = 901)] | ||
List(ListCommand), | ||
} | ||
|
||
impl ServiceCommand { | ||
pub fn run(self, opts: CommandGlobalOpts) -> miette::Result<()> { | ||
match self.subcommand { | ||
ServiceSubcommand::Start(c) => c.run(opts), | ||
ServiceSubcommand::List(c) => c.run(opts), | ||
} | ||
} | ||
impl ServiceCommand { | ||
pub fn run(self, opts: CommandGlobalOpts) -> miette::Result<()> { | ||
match self.subcommand { | ||
ServiceSubcommand::Start(c) => c.run(opts), | ||
ServiceSubcommand::List(c) => c.run(opts), | ||
} | ||
} | ||
|
||
pub fn name(&self) -> String { | ||
match &self.subcommand { | ||
ServiceSubcommand::Start(c) => c.name(), | ||
ServiceSubcommand::List(c) => c.name(), | ||
} | ||
} | ||
pub fn name(&self) -> String { | ||
match &self.subcommand { | ||
ServiceSubcommand::Start(c) => c.name(), | ||
ServiceSubcommand::List(c) => c.name(), | ||
} | ||
} | ||
} |
Oops, something went wrong.