make executable and subcmd mandatory args

This commit is contained in:
Max Eisner 2022-08-10 15:11:06 +02:00
parent e448601964
commit 55a26ce4cc
No known key found for this signature in database
GPG Key ID: 4BF122C22879F0C8

View File

@ -1627,22 +1627,21 @@ class Formula
# Generate shell completions for a formula for bash, zsh, and fish, using the formula's executable.
#
# @param executable [Pathname] the executable to use for generating the completion scripts.
# @param subcmd [String] the command to pass to the `executable`.
# @param base_name [String] the base name of the generated completion script. Defaults to the formula name.
# @param shells [Array<Symbol>] the shells to generate completion scripts for. Defaults to `[:bash, :zsh, :fish]`.
# @param executable [Pathname] the executable to use for generating the completion scripts. Defaults to the
# executable with the name of the formula.
# @param subcmd [String] the command to pass to the `executable`. Defaults to 'completion'.
# @param shell_parameter_format [String]/[Symbol] specify how `shells` should each be passed
# to the `executable`. Takes either a String representing a prefix, or one of [:flag, :arg, :none].
# Defaults to plainly passing the shell.
sig {
params(base_name: String, shells: T::Array[Symbol], executable: Pathname, subcmd: String,
params(executable: Pathname, subcmd: String, base_name: String, shells: T::Array[Symbol],
shell_parameter_format: T.nilable(T.any(Symbol, String))).void
}
def generate_completions_from_executable(base_name: name,
def generate_completions_from_executable(executable,
subcmd,
base_name: name,
shells: [:bash, :zsh, :fish],
executable: bin/base_name,
subcmd: "completion",
shell_parameter_format: nil)
completion_script_path_map = {
bash: bash_completion/base_name,