Skip to content

Commit

Permalink
prevent enabled command fallback to Python when it's run without --help
Browse files Browse the repository at this point in the history
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
  • Loading branch information
chadaustin authored and facebook-github-bot committed Mar 31, 2023
1 parent c682ccc commit 56c1538
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion eden/fs/cli_rs/edenfsctl/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ fn wrapper_main() -> Result<i32> {
// 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()
Expand Down

0 comments on commit 56c1538

Please sign in to comment.