From c7459787e60fc2aee268f90948d8567ea9cf3c04 Mon Sep 17 00:00:00 2001 From: Kriogenia <47500377+kriogenia@users.noreply.github.com> Date: Fri, 13 Oct 2023 10:32:39 +0100 Subject: [PATCH] fix(rust): abort on ockam enroll --output json --- .../rust/ockam/ockam_command/src/enroll/command.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/implementations/rust/ockam/ockam_command/src/enroll/command.rs b/implementations/rust/ockam/ockam_command/src/enroll/command.rs index a9d922b2c3c..bf6e8a60fc5 100644 --- a/implementations/rust/ockam/ockam_command/src/enroll/command.rs +++ b/implementations/rust/ockam/ockam_command/src/enroll/command.rs @@ -25,6 +25,7 @@ use ockam_api::nodes::InMemoryNode; use crate::enroll::OidcServiceExt; use crate::identity::initialize_identity_if_default; use crate::operation::util::check_for_completion; +use crate::output::OutputFormat; use crate::project::util::check_project_readiness; use crate::terminal::OckamColor; use crate::util::node_rpc; @@ -57,6 +58,12 @@ impl EnrollCommand { } async fn rpc(ctx: Context, (opts, cmd): (CommandGlobalOpts, EnrollCommand)) -> miette::Result<()> { + if opts.global_args.output_format == OutputFormat::Json { + return Err(miette::miette!( + "The flag --output json is invalid for this command." + )); + } + run_impl(&ctx, opts, cmd).await }