From 24c080d85bd4eb9dd4943e06903e2f152f739fb1 Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Tue, 14 May 2024 15:13:11 +1000 Subject: [PATCH 1/2] Make CLI component pub accessible --- src/cli/mod.rs | 8 ++++---- src/cli/types.rs | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/cli/mod.rs b/src/cli/mod.rs index f8da43ad..1fea239c 100644 --- a/src/cli/mod.rs +++ b/src/cli/mod.rs @@ -1,7 +1,7 @@ -mod decode; -mod encode; -mod guess; -mod types; +pub mod decode; +pub mod encode; +pub mod guess; +pub mod types; mod version; use clap::{Parser, Subcommand, ValueEnum}; diff --git a/src/cli/types.rs b/src/cli/types.rs index a0ad2790..59e87ea2 100644 --- a/src/cli/types.rs +++ b/src/cli/types.rs @@ -1,4 +1,4 @@ -mod list; +pub mod list; use clap::{Args, Subcommand}; @@ -12,7 +12,7 @@ pub struct Cmd { } #[derive(Subcommand, Clone, Debug)] -pub enum Sub { +enum Sub { List(list::Cmd), } From 5f3299ac042393d0f99262c89aad84d51483e4b3 Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Wed, 15 May 2024 16:08:53 +1000 Subject: [PATCH 2/2] fix clippy errors --- src/cli/decode.rs | 5 +++++ src/cli/encode.rs | 5 +++++ src/cli/guess.rs | 5 +++++ src/cli/types.rs | 5 +++++ src/cli/types/list.rs | 5 +++++ 5 files changed, 25 insertions(+) diff --git a/src/cli/decode.rs b/src/cli/decode.rs index d60c989c..8eabf0ff 100644 --- a/src/cli/decode.rs +++ b/src/cli/decode.rs @@ -115,6 +115,11 @@ macro_rules! run_x { } impl Cmd { + /// Run the CLIs decode command. + /// + /// ## Errors + /// + /// If the command is configured with state that is invalid. pub fn run(&self, channel: &Channel) -> Result<(), Error> { match channel { Channel::Curr => self.run_curr()?, diff --git a/src/cli/encode.rs b/src/cli/encode.rs index ba588790..07da4b07 100644 --- a/src/cli/encode.rs +++ b/src/cli/encode.rs @@ -131,6 +131,11 @@ macro_rules! run_x { } impl Cmd { + /// Run the CLIs encode command. + /// + /// ## Errors + /// + /// If the command is configured with state that is invalid. pub fn run(&self, channel: &Channel) -> Result<(), Error> { match channel { Channel::Curr => self.run_curr()?, diff --git a/src/cli/guess.rs b/src/cli/guess.rs index 4f48820b..5212fc04 100644 --- a/src/cli/guess.rs +++ b/src/cli/guess.rs @@ -128,6 +128,11 @@ macro_rules! run_x { } impl Cmd { + /// Run the CLIs guess command. + /// + /// ## Errors + /// + /// If the command is configured with state that is invalid. pub fn run(&self, channel: &Channel) -> Result<(), Error> { match channel { Channel::Curr => self.run_curr()?, diff --git a/src/cli/types.rs b/src/cli/types.rs index 59e87ea2..f089930e 100644 --- a/src/cli/types.rs +++ b/src/cli/types.rs @@ -17,6 +17,11 @@ enum Sub { } impl Cmd { + /// Run the CLIs types command. + /// + /// ## Panics + /// + /// If the lists sub-command panics. pub fn run(&self, channel: &Channel) { match &self.sub { Sub::List(c) => c.run(channel), diff --git a/src/cli/types/list.rs b/src/cli/types/list.rs index 30054ac4..a5641e0c 100644 --- a/src/cli/types/list.rs +++ b/src/cli/types/list.rs @@ -24,6 +24,11 @@ impl Default for OutputFormat { } impl Cmd { + /// Run the CLIs types list command. + /// + /// ## Panics + /// + /// If the list cannot be rendered as JSON. pub fn run(&self, channel: &Channel) { let types = Self::types(channel); match self.output {