From 3bc01a4d31305f23618f0e2658ccb86927600dbb Mon Sep 17 00:00:00 2001 From: Ruoyu Zhong Date: Sun, 14 Jul 2024 14:33:57 -0400 Subject: [PATCH] Fix completion generation for `--repository` --- Library/Homebrew/cmd/--repository.rb | 33 ++++++++++++++++++++++++++++ Library/Homebrew/commands.rb | 1 + 2 files changed, 34 insertions(+) create mode 100644 Library/Homebrew/cmd/--repository.rb diff --git a/Library/Homebrew/cmd/--repository.rb b/Library/Homebrew/cmd/--repository.rb new file mode 100644 index 0000000000..2666feb488 --- /dev/null +++ b/Library/Homebrew/cmd/--repository.rb @@ -0,0 +1,33 @@ +# typed: strict +# frozen_string_literal: true + +require "abstract_command" + +# This Ruby command exists to allow generation of completions for the Bash +# version. +# It is not meant to be run. +module Homebrew + module Cmd + class Repository < AbstractCommand + sig { override.returns(String) } + def self.command_name = "--repository" + + cmd_args do + description <<~EOS + Display where Homebrew's Git repository is located. + + If `/` are provided, display where tap `/`'s directory is located. + EOS + + named_args :tap + + hide_from_man_page! + end + + sig { override.void } + def run + raise StandardError, "This command is not meant to be run." + end + end + end +end diff --git a/Library/Homebrew/commands.rb b/Library/Homebrew/commands.rb index 19c172d971..ab4928aa00 100644 --- a/Library/Homebrew/commands.rb +++ b/Library/Homebrew/commands.rb @@ -140,6 +140,7 @@ module Commands def self.find_internal_commands(path) find_commands(path).map(&:basename) .map { basename_without_extension(_1) } + .uniq end def self.external_commands