Superpositional
AboutReview principlesPricingBlogGalleryAsk a RepoFAQ…
← Back to galleryAsk this repo
Approved · 0 retained findingsclap-rs/clap#6422

Fix fish indentations

Input

PR author’s description

<!-- Thanks for helping out! Please link the appropriate issue from your PR. If you don't have an issue, we'd recommend starting with one first so the PR can focus on the implementation (unless its an obvious bug…

PR diff

Current GitHub diff ↗
clap_complete/src/aot/shells/fish.rs · patch excerpt
-        "\-        # Print an optspec for argparse to handle cmd's options that are independent of any subcommand.\n\-        function {optspecs_fn_name}\n\-        \tstring join \\n{optspecs}\n\
Browse 10 changed files
clap_complete/src/aot/shells/fish.rs+28 −25
@@ -247,31 +247,34 @@ fn gen_subcommand_helpers(     let optspecs_fn_name = format!("__fish_{bin_name}_global_optspecs");     write!(         buf,-        "\-        # Print an optspec for argparse to handle cmd's options that are independent of any subcommand.\n\-        function {optspecs_fn_name}\n\-        \tstring join \\n{optspecs}\n\-        end\n\n\-        function {needs_fn_name}\n\-        \t# Figure out if the current invocation already has a command.\n\-        \tset -l cmd (commandline -opc)\n\-        \tset -e cmd[1]\n\-        \targparse -s ({optspecs_fn_name}) -- $cmd 2>/dev/null\n\-        \tor return\n\-        \tif set -q argv[1]\n\-        \t\t# Also print the command, so this can be used to figure out what it is.\n\-        \t\techo $argv[1]\n\-        \t\treturn 1\n\-        \tend\n\-        \treturn 0\n\-        end\n\n\-        function {using_fn_name}\n\-        \tset -l cmd ({needs_fn_name})\n\-        \ttest -z \"$cmd\"\n\-        \tand return 1\n\-        \tcontains -- $cmd[1] $argv\n\-        end\n\n\-    ").expect("failed to write completion file");+        "# Print an optspec for argparse to handle cmd's options that are independent of any subcommand.+function {optspecs_fn_name}+    string join \\n{optspecs}+end++function {needs_fn_name}+    # Figure out if the current invocation already has a command.+    set -l cmd (commandline -opc)+    set -e cmd[1]+    argparse -s ({optspecs_fn_name}) -- $cmd 2>/dev/null+    or return+    if set -q argv[1]+        # Also print the command, so this can be used to figure out what it is.+        echo $argv[1]+        return 1+    end+    return 0+end++function {using_fn_name}+    set -l cmd ({needs_fn_name})+    test -z \"$cmd\"+    and return 1+    contains -- $cmd[1] $argv+end++"+        ).expect("failed to write completion file"); }  fn value_completion(option: &Arg) -> String {
clap_complete/tests/snapshots/basic.fish+16 −16
@@ -1,27 +1,27 @@ # Print an optspec for argparse to handle cmd's options that are independent of any subcommand. function __fish_my_app_global_optspecs-	string join \n c v h/help+    string join \n c v h/help end  function __fish_my_app_needs_command-	# Figure out if the current invocation already has a command.-	set -l cmd (commandline -opc)-	set -e cmd[1]-	argparse -s (__fish_my_app_global_optspecs) -- $cmd 2>/dev/null-	or return-	if set -q argv[1]-		# Also print the command, so this can be used to figure out what it is.-		echo $argv[1]-		return 1-	end-	return 0+    # Figure out if the current invocation already has a command.+    set -l cmd (commandline -opc)+    set -e cmd[1]+    argparse -s (__fish_my_app_global_optspecs) -- $cmd 2>/dev/null+    or return+    if set -q argv[1]+        # Also print the command, so this can be used to figure out what it is.+        echo $argv[1]+        return 1+    end+    return 0 end  function __fish_my_app_using_subcommand-	set -l cmd (__fish_my_app_needs_command)-	test -z "$cmd"-	and return 1-	contains -- $cmd[1] $argv+    set -l cmd (__fish_my_app_needs_command)+    test -z "$cmd"+    and return 1+    contains -- $cmd[1] $argv end  complete -c my-app -n "__fish_my_app_needs_command" -s c
clap_complete/tests/snapshots/custom_bin_name.fish+16 −16
@@ -1,27 +1,27 @@ # Print an optspec for argparse to handle cmd's options that are independent of any subcommand. function __fish_bin_name_global_optspecs-	string join \n c v h/help+    string join \n c v h/help end  function __fish_bin_name_needs_command-	# Figure out if the current invocation already has a command.-	set -l cmd (commandline -opc)-	set -e cmd[1]-	argparse -s (__fish_bin_name_global_optspecs) -- $cmd 2>/dev/null-	or return-	if set -q argv[1]-		# Also print the command, so this can be used to figure out what it is.-		echo $argv[1]-		return 1-	end-	return 0+    # Figure out if the current invocation already has a command.+    set -l cmd (commandline -opc)+    set -e cmd[1]+    argparse -s (__fish_bin_name_global_optspecs) -- $cmd 2>/dev/null+    or return+    if set -q argv[1]+        # Also print the command, so this can be used to figure out what it is.+        echo $argv[1]+        return 1+    end+    return 0 end  function __fish_bin_name_using_subcommand-	set -l cmd (__fish_bin_name_needs_command)-	test -z "$cmd"-	and return 1-	contains -- $cmd[1] $argv+    set -l cmd (__fish_bin_name_needs_command)+    test -z "$cmd"+    and return 1+    contains -- $cmd[1] $argv end  complete -c bin-name -n "__fish_bin_name_needs_command" -s c

→ Outcome

Why this verdict

approve — No checked defect was established by the available proof adapters.

Lens observations (not verified against the evidence ledger):

  • dependency_blast_radius: The PR rewriting the gen_subcommand_helpers template in Rust removes the original template markup that produced output with tabs, changing the syntax of the generated completion functions in all affected snapshots and thus breaking shell syntax expectations for any manually-editored templates or configurations that relied on the tab-based format.

Lens coverage: 6 delivered

The recorded observations did not become verified findings.

Evidence and perspectives

  • Observation · Dependency blast radiusThe PR rewriting the gen_subcommand_helpers template in Rust removes the original template markup that produced output with tabs, changing the syntax of the generated completion functions in all affected snapshots and thus breaking shell syntax expectations for any manually-editored templates or configurations that relied on the tab-based format.
  • Observation · Dependency blast radiusThe try_generate function calls gen_subcommand_helpers, which in turn calls escape_string to produce completion assets; changes to gen_subcommand_helpers transitively affect user-facing completion generation unless the escape_string logic is updated in parallel.

    Recorded location clap_complete/src/aot/shells/fish.rs:12

Supporting evidence

Reviewed 27 Nov 2026Revision f90a96636ad310 changed files+172 −169Judge score 5/5
AboutReview principlesSupportPrivacyContact
(C) 2026 Superpositional>
Member of the NVIDIA Inception Program