Skip to content

Commit

Permalink
fix(rust): Abort on ockam enroll --output json
Browse files Browse the repository at this point in the history
Add an early exit to the command `ockam enroll` when
used with the `--output json` flag.

Close build-trust#6119
  • Loading branch information
kriogenia committed Oct 14, 2023
1 parent 8373fa4 commit 049b92c
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -91,6 +92,12 @@ async fn run_impl(
opts: CommandGlobalOpts,
_cmd: EnrollCommand,
) -> miette::Result<()> {
if opts.global_args.output_format == OutputFormat::Json {
return Err(miette::miette!(
"The flag --output json is invalid for this command."
));
}

opts.terminal.write_line(&fmt_log!(
"Enrolling your default Ockam identity with Ockam Orchestrator...\n"
))?;
Expand Down

0 comments on commit 049b92c

Please sign in to comment.