brew commands
Shows a list of built-in commands (but not shortcuts) and searches for any external commands on the path. Closes Homebrew/homebrew#22509.
This commit is contained in:
parent
7c0f474d26
commit
fa0872a42c
@ -403,6 +403,7 @@ _brew ()
|
||||
audit
|
||||
cat
|
||||
cleanup
|
||||
commands
|
||||
create
|
||||
deps
|
||||
diy configure
|
||||
|
@ -27,6 +27,7 @@ _1st_arguments=(
|
||||
'audit:check formulae for Homebrew coding style'
|
||||
'cat:display formula file for a formula'
|
||||
'cleanup:uninstall unused and old versions of packages'
|
||||
'commands:show a list of commands'
|
||||
'create:create a new formula'
|
||||
'deps:list dependencies and dependants of a formula'
|
||||
'doctor:audits your installation for common issues'
|
||||
|
@ -64,6 +64,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)`
|
||||
|
||||
* `commands`:
|
||||
Show a list of built-in and external commands.
|
||||
|
||||
* `create <URL> [--autotools|--cmake] [--no-fetch] [--set-name <name>] [--set-version <version>]`:
|
||||
Generate a formula for the downloadable file at <URL> and open it in the editor.
|
||||
Homebrew will attempt to automatically derive the formula name
|
||||
|
33
Library/Homebrew/cmd/commands.rb
Normal file
33
Library/Homebrew/cmd/commands.rb
Normal file
@ -0,0 +1,33 @@
|
||||
module Homebrew extend self
|
||||
def paths
|
||||
@paths ||= ENV['PATH'].split(File::PATH_SEPARATOR).collect do |p|
|
||||
begin
|
||||
File.expand_path(p).chomp('/')
|
||||
rescue ArgumentError
|
||||
onoe "The following PATH component is invalid: #{p}"
|
||||
end
|
||||
end.uniq.compact
|
||||
end
|
||||
|
||||
def commands
|
||||
# Find commands in Homebrew/cmd
|
||||
cmds = (HOMEBREW_REPOSITORY/"Library/Homebrew/cmd").
|
||||
children(with_directory=false).
|
||||
map {|f| File.basename(f, '.rb')}
|
||||
puts "Built-in commands"
|
||||
puts_columns cmds
|
||||
|
||||
# Find commands in the path
|
||||
exts = paths.map{ |p| Dir["#{p}/*"] }.flatten.
|
||||
map{ |f| File.basename f }.
|
||||
select{ |f| f =~ /^brew-(.+)/ }.
|
||||
map{ |f| File.basename(f, '.rb')[5..-1] }.
|
||||
reject{ |f| f =~ /\./ }
|
||||
|
||||
unless exts.empty?
|
||||
puts
|
||||
puts "External commands"
|
||||
puts_columns exts
|
||||
end
|
||||
end
|
||||
end
|
@ -71,6 +71,10 @@ If \fB\-n\fR is passed, show what would be removed, but do not actually remove a
|
||||
If \fB\-s\fR is passed, scrubs the cache, removing downloads for even the latest versions of formula\. Note downloads for any installed formula will still not be deleted\. If you want to delete those too: \fBrm \-rf $(brew \-\-cache)\fR
|
||||
.
|
||||
.TP
|
||||
\fBcommands\fR
|
||||
Show a list of built\-in and external commands\.
|
||||
.
|
||||
.TP
|
||||
\fBcreate <URL> [\-\-autotools|\-\-cmake] [\-\-no\-fetch] [\-\-set\-name <name>] [\-\-set\-version <version>]\fR
|
||||
Generate a formula for the downloadable file at \fIURL\fR and open it in the editor\. Homebrew will attempt to automatically derive the formula name and version, but if it fails, you\'ll have to make your own template\. The wget formula serves as a simple example\. For a complete cheat\-sheet, have a look at
|
||||
.
|
||||
|
Loading…
x
Reference in New Issue
Block a user