diff options
Diffstat (limited to 'Library/Homebrew')
| -rw-r--r-- | Library/Homebrew/cmd/command.rb | 14 | ||||
| -rw-r--r-- | Library/Homebrew/global.rb | 17 | ||||
| -rw-r--r-- | Library/Homebrew/manpages/brew.1.md | 3 |
3 files changed, 34 insertions, 0 deletions
diff --git a/Library/Homebrew/cmd/command.rb b/Library/Homebrew/cmd/command.rb new file mode 100644 index 000000000..c2ea96dab --- /dev/null +++ b/Library/Homebrew/cmd/command.rb @@ -0,0 +1,14 @@ +module Homebrew + def command + cmd = ARGV.first + cmd = HOMEBREW_INTERNAL_COMMAND_ALIASES.fetch(cmd, cmd) + + if (path = HOMEBREW_LIBRARY_PATH/"cmd/#{cmd}.rb"; path.file?) + puts path + elsif (path = which("brew-#{cmd}") || which("brew-#{cmd}.rb")) + puts path + else + odie "Unknown command: #{cmd}" + end + end +end diff --git a/Library/Homebrew/global.rb b/Library/Homebrew/global.rb index ba79f40d6..d9ec1a265 100644 --- a/Library/Homebrew/global.rb +++ b/Library/Homebrew/global.rb @@ -54,3 +54,20 @@ HOMEBREW_PULL_OR_COMMIT_URL_REGEX = %r[https://github\.com/([\w-]+)/homebrew(-[\ require 'compat' unless ARGV.include? "--no-compat" or ENV['HOMEBREW_NO_COMPAT'] ORIGINAL_PATHS = ENV['PATH'].split(File::PATH_SEPARATOR).map{ |p| Pathname.new(p).expand_path rescue nil }.compact.freeze + +HOMEBREW_INTERNAL_COMMAND_ALIASES = { + 'ls' => 'list', + 'homepage' => 'home', + '-S' => 'search', + 'up' => 'update', + 'ln' => 'link', + 'instal' => 'install', # gem does the same + 'rm' => 'uninstall', + 'remove' => 'uninstall', + 'configure' => 'diy', + 'abv' => 'info', + 'dr' => 'doctor', + '--repo' => '--repository', + 'environment' => '--env', + '--config' => 'config', +} diff --git a/Library/Homebrew/manpages/brew.1.md b/Library/Homebrew/manpages/brew.1.md index 909b7448c..273228b4c 100644 --- a/Library/Homebrew/manpages/brew.1.md +++ b/Library/Homebrew/manpages/brew.1.md @@ -69,6 +69,9 @@ Note that these flags should only appear after a command. versions of formula. Note downloads for any installed formula will still not be deleted. If you want to delete those too: `rm -rf $(brew --cache)` + * `command` <cmd>: + Display the path to the file which is used when invoking `brew <cmd>`. + * `commands`: Show a list of built-in and external commands. |
