Class: Homebrew::Cmd::CommandNotFoundInit Private
- Inherits:
-
AbstractCommand
- Object
- AbstractCommand
- Homebrew::Cmd::CommandNotFoundInit
- Defined in:
- cmd/command-not-found-init.rb,
sorbet/rbi/dsl/homebrew/cmd/command_not_found_init.rbi
This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.
Defined Under Namespace
Classes: Args
Instance Method Summary collapse
- #args ⇒ Homebrew::Cmd::CommandNotFoundInit::Args private
- #help ⇒ void private
- #init ⇒ void private
- #run ⇒ void private
- #shell ⇒ Symbol? private
Methods inherited from AbstractCommand
command, command_name, dev_cmd?, #initialize, parser, ruby_cmd?
Methods included from Utils::Output::Mixin
#odebug, #odeprecated, #odie, #odisabled, #ofail, #oh1, #oh1_title, #ohai, #ohai_title, #onoe, #opoo, #opoo_outside_github_actions, #pretty_duration, #pretty_installed, #pretty_outdated, #pretty_uninstalled
Constructor Details
This class inherits a constructor from Homebrew::AbstractCommand
Instance Method Details
#args ⇒ Homebrew::Cmd::CommandNotFoundInit::Args
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
10 |
# File 'sorbet/rbi/dsl/homebrew/cmd/command_not_found_init.rbi', line 10 def args; end |
#help ⇒ void
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
This method returns an undefined value.
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'cmd/command-not-found-init.rb', line 51 def help case shell when :bash, :zsh puts <<~EOS # To enable command-not-found # Add the following lines to ~/.#{shell}rc HOMEBREW_COMMAND_NOT_FOUND_HANDLER="$(brew --repository)/Library/Homebrew/command-not-found/handler.sh" if [ -f "$HOMEBREW_COMMAND_NOT_FOUND_HANDLER" ]; then source "$HOMEBREW_COMMAND_NOT_FOUND_HANDLER"; fi EOS when :fish puts <<~EOS # To enable command-not-found # Add the following line to ~/.config/fish/config.fish set HOMEBREW_COMMAND_NOT_FOUND_HANDLER (brew --repository)/Library/Homebrew/command-not-found/handler.fish if test -f $HOMEBREW_COMMAND_NOT_FOUND_HANDLER source $HOMEBREW_COMMAND_NOT_FOUND_HANDLER end EOS else raise "Unsupported shell type #{shell}" end end |
#init ⇒ void
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
This method returns an undefined value.
39 40 41 42 43 44 45 46 47 48 |
# File 'cmd/command-not-found-init.rb', line 39 def init case shell when :bash, :zsh puts File.read(File.("#{File.dirname(__FILE__)}/../command-not-found/handler.sh")) when :fish puts File.("#{File.dirname(__FILE__)}/../command-not-found/handler.fish") else raise "Unsupported shell type #{shell}" end end |
#run ⇒ void
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
This method returns an undefined value.
25 26 27 28 29 30 31 |
# File 'cmd/command-not-found-init.rb', line 25 def run if $stdout.tty? help else init end end |
#shell ⇒ Symbol?
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
34 35 36 |
# File 'cmd/command-not-found-init.rb', line 34 def shell Utils::Shell.parent || Utils::Shell.preferred end |