From 56c1538580fbc934dd6f972b6d3a0d62d25a6ebd Mon Sep 17 00:00:00 2001 From: Chad Austin Date: Fri, 31 Mar 2023 11:08:05 -0700 Subject: [PATCH] prevent enabled command fallback to Python when it's run without --help Summary: I'm introducing a new Rust-only command implementation, and I never want it to fall back to Python help, even if it's run without a required option. Therefore, handle DisplayHelpOnMissingArgumentOrSubcommand as well as DisplayHelp. Reviewed By: fanzeyi Differential Revision: D44560239 fbshipit-source-id: 43c418da3c980a34a11277c82bf350822b0bc71b --- eden/fs/cli_rs/edenfsctl/src/main.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eden/fs/cli_rs/edenfsctl/src/main.rs b/eden/fs/cli_rs/edenfsctl/src/main.rs index 389920e15fd9b..e5fa47eed2563 100644 --- a/eden/fs/cli_rs/edenfsctl/src/main.rs +++ b/eden/fs/cli_rs/edenfsctl/src/main.rs @@ -183,7 +183,8 @@ fn wrapper_main() -> Result { // UnknownArgument (whether or not --help was requested) and we // should fall back to Python. Err(e) => { - if e.kind() == clap::ErrorKind::DisplayHelp + if (e.kind() == clap::ErrorKind::DisplayHelp + || e.kind() == clap::ErrorKind::DisplayHelpOnMissingArgumentOrSubcommand) && should_use_rust_help(std::env::args(), &None).unwrap_or(false) { e.exit()