cmd: improve wording of messages, spacing
This commit is contained in:
parent
c246207ba0
commit
2f7c3afeb8
@ -42,7 +42,7 @@ module Homebrew
|
|||||||
when "regenerate-uuid"
|
when "regenerate-uuid"
|
||||||
Utils::Analytics.regenerate_uuid!
|
Utils::Analytics.regenerate_uuid!
|
||||||
else
|
else
|
||||||
raise UsageError
|
raise UsageError, "Unknown subcommand."
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -20,12 +20,11 @@ module Homebrew
|
|||||||
|
|
||||||
def command
|
def command
|
||||||
command_args.parse
|
command_args.parse
|
||||||
abort "This command requires a command argument" if args.remaining.empty?
|
|
||||||
|
raise UsageError, "This command requires a command argument" if args.remaining.empty?
|
||||||
|
|
||||||
cmd = HOMEBREW_INTERNAL_COMMAND_ALIASES.fetch(args.remaining.first, args.remaining.first)
|
cmd = HOMEBREW_INTERNAL_COMMAND_ALIASES.fetch(args.remaining.first, args.remaining.first)
|
||||||
|
|
||||||
path = Commands.path(cmd)
|
path = Commands.path(cmd)
|
||||||
|
|
||||||
cmd_paths = PATH.new(ENV["PATH"]).append(Tap.cmd_directories) unless path
|
cmd_paths = PATH.new(ENV["PATH"]).append(Tap.cmd_directories) unless path
|
||||||
path ||= which("brew-#{cmd}", cmd_paths)
|
path ||= which("brew-#{cmd}", cmd_paths)
|
||||||
path ||= which("brew-#{cmd}.rb", cmd_paths)
|
path ||= which("brew-#{cmd}.rb", cmd_paths)
|
||||||
|
|||||||
@ -47,7 +47,6 @@ module Homebrew
|
|||||||
|
|
||||||
def detect_version(path)
|
def detect_version(path)
|
||||||
version = path.version.to_s
|
version = path.version.to_s
|
||||||
|
|
||||||
raise "Couldn't determine version, set it with --version=<version>" if version.empty?
|
raise "Couldn't determine version, set it with --version=<version>" if version.empty?
|
||||||
|
|
||||||
version
|
version
|
||||||
|
|||||||
@ -61,22 +61,23 @@ module Homebrew
|
|||||||
|
|
||||||
def info
|
def info
|
||||||
info_args.parse
|
info_args.parse
|
||||||
|
|
||||||
if args.days.present?
|
if args.days.present?
|
||||||
raise UsageError, "days must be one of #{VALID_DAYS.join(", ")}" unless VALID_DAYS.include?(args.days)
|
raise UsageError, "--days must be one of #{VALID_DAYS.join(", ")}" unless VALID_DAYS.include?(args.days)
|
||||||
end
|
end
|
||||||
|
|
||||||
if args.category.present?
|
if args.category.present?
|
||||||
if ARGV.named.present? && !VALID_FORMULA_CATEGORIES.include?(args.category)
|
if ARGV.named.present? && !VALID_FORMULA_CATEGORIES.include?(args.category)
|
||||||
raise UsageError, "category must be one of #{VALID_FORMULA_CATEGORIES.join(", ")} when querying formulae"
|
raise UsageError, "--category must be one of #{VALID_FORMULA_CATEGORIES.join(", ")} when querying formulae"
|
||||||
end
|
end
|
||||||
|
|
||||||
unless VALID_CATEGORIES.include?(args.category)
|
unless VALID_CATEGORIES.include?(args.category)
|
||||||
raise UsageError, "category must be one of #{VALID_CATEGORIES.join(", ")}"
|
raise UsageError, "--category must be one of #{VALID_CATEGORIES.join(", ")}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if args.json
|
if args.json
|
||||||
raise UsageError, "invalid JSON version: #{args.json}" unless ["v1", true].include? args.json
|
raise UsageError, "Invalid JSON version: #{args.json}" unless ["v1", true].include? args.json
|
||||||
|
|
||||||
print_json
|
print_json
|
||||||
elsif args.github?
|
elsif args.github?
|
||||||
|
|||||||
@ -101,6 +101,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
install_args.parse
|
install_args.parse
|
||||||
|
|
||||||
raise FormulaUnspecifiedError if args.remaining.empty?
|
raise FormulaUnspecifiedError if args.remaining.empty?
|
||||||
|
|
||||||
if args.ignore_dependencies?
|
if args.ignore_dependencies?
|
||||||
|
|||||||
@ -48,7 +48,10 @@ module Homebrew
|
|||||||
else
|
else
|
||||||
keg.name
|
keg.name
|
||||||
end
|
end
|
||||||
puts "To relink: brew unlink #{keg.name} && brew link #{name_and_flag}"
|
puts <<~EOS
|
||||||
|
To relink:
|
||||||
|
brew unlink #{keg.name} && brew link #{name_and_flag}
|
||||||
|
EOS
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -27,6 +27,7 @@ module Homebrew
|
|||||||
|
|
||||||
def missing
|
def missing
|
||||||
missing_args.parse
|
missing_args.parse
|
||||||
|
|
||||||
return unless HOMEBREW_CELLAR.exist?
|
return unless HOMEBREW_CELLAR.exist?
|
||||||
|
|
||||||
ff = if ARGV.named.empty?
|
ff = if ARGV.named.empty?
|
||||||
|
|||||||
@ -41,7 +41,7 @@ module Homebrew
|
|||||||
ARGV.resolved_formulae
|
ARGV.resolved_formulae
|
||||||
end
|
end
|
||||||
if args.json
|
if args.json
|
||||||
raise UsageError, "invalid JSON version: #{args.json}" unless ["v1", true].include? args.json
|
raise UsageError, "Invalid JSON version: #{args.json}" unless ["v1", true].include? args.json
|
||||||
|
|
||||||
outdated = print_outdated_json(formulae)
|
outdated = print_outdated_json(formulae)
|
||||||
else
|
else
|
||||||
|
|||||||
@ -27,6 +27,7 @@ module Homebrew
|
|||||||
|
|
||||||
def sh
|
def sh
|
||||||
sh_args.parse
|
sh_args.parse
|
||||||
|
|
||||||
ENV.activate_extensions!
|
ENV.activate_extensions!
|
||||||
|
|
||||||
if superenv?
|
if superenv?
|
||||||
|
|||||||
@ -36,7 +36,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
if args.json
|
if args.json
|
||||||
raise UsageError, "invalid JSON version: #{args.json}" unless ["v1", true].include? args.json
|
raise UsageError, "Invalid JSON version: #{args.json}" unless ["v1", true].include? args.json
|
||||||
|
|
||||||
print_tap_json(taps.sort_by(&:to_s))
|
print_tap_json(taps.sort_by(&:to_s))
|
||||||
else
|
else
|
||||||
|
|||||||
@ -79,7 +79,7 @@ module Homebrew
|
|||||||
if rack.directory?
|
if rack.directory?
|
||||||
versions = rack.subdirs.map(&:basename)
|
versions = rack.subdirs.map(&:basename)
|
||||||
puts "#{keg.name} #{versions.to_sentence} #{"is".pluralize(versions.count)} still installed."
|
puts "#{keg.name} #{versions.to_sentence} #{"is".pluralize(versions.count)} still installed."
|
||||||
puts "Remove all versions with `brew uninstall --force #{keg.name}`."
|
puts "Run `brew uninstall --force #{keg.name}` to remove all versions."
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -87,7 +87,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
rescue MultipleVersionsInstalledError => e
|
rescue MultipleVersionsInstalledError => e
|
||||||
ofail e
|
ofail e
|
||||||
puts "Use `brew uninstall --force #{e.name}` to remove all versions."
|
puts "Run `brew uninstall --force #{e.name}` to remove all versions."
|
||||||
ensure
|
ensure
|
||||||
# If we delete Cellar/newname, then Cellar/oldname symlink
|
# If we delete Cellar/newname, then Cellar/oldname symlink
|
||||||
# can become broken and we have to remove it.
|
# can become broken and we have to remove it.
|
||||||
|
|||||||
@ -19,11 +19,11 @@ module Homebrew
|
|||||||
def untap
|
def untap
|
||||||
untap_args.parse
|
untap_args.parse
|
||||||
|
|
||||||
raise "Usage is `brew untap <tap-name>`" if args.remaining.empty?
|
raise UsageError, "This command requires a tap argument from `brew tap`'s list" if args.remaining.empty?
|
||||||
|
|
||||||
ARGV.named.each do |tapname|
|
ARGV.named.each do |tapname|
|
||||||
tap = Tap.fetch(tapname)
|
tap = Tap.fetch(tapname)
|
||||||
raise "untapping #{tap} is not allowed" if tap.core_tap?
|
odie "Untapping #{tap} is not allowed" if tap.core_tap?
|
||||||
|
|
||||||
tap.uninstall
|
tap.uninstall
|
||||||
end
|
end
|
||||||
|
|||||||
@ -314,7 +314,7 @@ homebrew-update() {
|
|||||||
*)
|
*)
|
||||||
odie <<EOS
|
odie <<EOS
|
||||||
This command updates brew itself, and does not take formula names.
|
This command updates brew itself, and does not take formula names.
|
||||||
Use 'brew upgrade $@' instead.
|
Use \`brew upgrade $@\` instead.
|
||||||
EOS
|
EOS
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@ -511,7 +511,7 @@ EOS
|
|||||||
if [[ "$UPSTREAM_SHA_HTTP_CODE" = "404" ]]
|
if [[ "$UPSTREAM_SHA_HTTP_CODE" = "404" ]]
|
||||||
then
|
then
|
||||||
TAP="${DIR#$HOMEBREW_LIBRARY/Taps/}"
|
TAP="${DIR#$HOMEBREW_LIBRARY/Taps/}"
|
||||||
echo "$TAP does not exist! Run 'brew untap $TAP'" >>"$update_failed_file"
|
echo "$TAP does not exist! Run \`brew untap $TAP\` to remove it." >>"$update_failed_file"
|
||||||
else
|
else
|
||||||
echo "Fetching $DIR failed!" >>"$update_failed_file"
|
echo "Fetching $DIR failed!" >>"$update_failed_file"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@ -219,7 +219,7 @@ module Homebrew
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
return ofail "Formula not installed with '--build-bottle': #{f.full_name}" unless Utils::Bottles.built_as? f
|
return ofail "Formula was not installed with --build-bottle: #{f.full_name}" unless Utils::Bottles.built_as? f
|
||||||
|
|
||||||
return ofail "Formula has no stable version: #{f.full_name}" unless f.stable
|
return ofail "Formula has no stable version: #{f.full_name}" unless f.stable
|
||||||
|
|
||||||
|
|||||||
@ -504,6 +504,6 @@ module Homebrew
|
|||||||
|
|
||||||
formula.path.atomic_write(backup_file)
|
formula.path.atomic_write(backup_file)
|
||||||
FileUtils.mv alias_rename.last, alias_rename.first if alias_rename.present?
|
FileUtils.mv alias_rename.last, alias_rename.first if alias_rename.present?
|
||||||
odie "brew audit failed!"
|
odie "`brew audit` failed!"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -98,7 +98,7 @@ module Homebrew
|
|||||||
extract_args.parse
|
extract_args.parse
|
||||||
|
|
||||||
# Expect exactly two named arguments: formula and tap
|
# Expect exactly two named arguments: formula and tap
|
||||||
raise UsageError if args.remaining.length != 2
|
raise UsageError, "This command requires formula and tap arguments" if args.remaining.length != 2
|
||||||
|
|
||||||
if args.remaining.first !~ HOMEBREW_TAP_FORMULA_REGEX
|
if args.remaining.first !~ HOMEBREW_TAP_FORMULA_REGEX
|
||||||
name = args.remaining.first.downcase
|
name = args.remaining.first.downcase
|
||||||
|
|||||||
@ -21,7 +21,7 @@ module Homebrew
|
|||||||
def mirror
|
def mirror
|
||||||
mirror_args.parse
|
mirror_args.parse
|
||||||
|
|
||||||
odie "This command requires at least one formula argument!" if ARGV.named.empty?
|
raise FormulaUnspecifiedError if args.remaining.empty?
|
||||||
|
|
||||||
bintray_user = ENV["HOMEBREW_BINTRAY_USER"]
|
bintray_user = ENV["HOMEBREW_BINTRAY_USER"]
|
||||||
bintray_key = ENV["HOMEBREW_BINTRAY_KEY"]
|
bintray_key = ENV["HOMEBREW_BINTRAY_KEY"]
|
||||||
|
|||||||
@ -70,7 +70,9 @@ module Homebrew
|
|||||||
|
|
||||||
pull_args.parse
|
pull_args.parse
|
||||||
|
|
||||||
odie "This command requires at least one argument containing a URL or pull request number" if ARGV.named.empty?
|
if ARGV.named.empty?
|
||||||
|
raise UsageError, "This command requires at least one argument containing a URL or pull request number"
|
||||||
|
end
|
||||||
|
|
||||||
# Passthrough Git environment variables for e.g. git am
|
# Passthrough Git environment variables for e.g. git am
|
||||||
ENV["GIT_COMMITTER_NAME"] = ENV["HOMEBREW_GIT_NAME"] if ENV["HOMEBREW_GIT_NAME"]
|
ENV["GIT_COMMITTER_NAME"] = ENV["HOMEBREW_GIT_NAME"] if ENV["HOMEBREW_GIT_NAME"]
|
||||||
@ -107,7 +109,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
_, testing_job = *testing_match
|
_, testing_job = *testing_match
|
||||||
url = "https://github.com/Homebrew/homebrew-#{tap.repo}/compare/master...BrewTestBot:testing-#{testing_job}"
|
url = "https://github.com/Homebrew/homebrew-#{tap.repo}/compare/master...BrewTestBot:testing-#{testing_job}"
|
||||||
odie "Testing URLs require `--bottle`!" unless args.bottle?
|
odie "--bottle is required for testing job URLs!" unless args.bottle?
|
||||||
elsif (api_match = arg.match HOMEBREW_PULL_API_REGEX)
|
elsif (api_match = arg.match HOMEBREW_PULL_API_REGEX)
|
||||||
_, user, repo, issue = *api_match
|
_, user, repo, issue = *api_match
|
||||||
url = "https://github.com/#{user}/#{repo}/pull/#{issue}"
|
url = "https://github.com/#{user}/#{repo}/pull/#{issue}"
|
||||||
@ -277,7 +279,7 @@ module Homebrew
|
|||||||
elsif patch_changes[:formulae].length > 1
|
elsif patch_changes[:formulae].length > 1
|
||||||
odie "Can only bump one changed formula; bumped #{patch_changes[:formulae]}"
|
odie "Can only bump one changed formula; bumped #{patch_changes[:formulae]}"
|
||||||
elsif !patch_changes[:others].empty?
|
elsif !patch_changes[:others].empty?
|
||||||
odie "Can not bump if non-formula files are changed"
|
odie "Cannot bump if non-formula files are changed"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@ module Homebrew
|
|||||||
def tap_new
|
def tap_new
|
||||||
tap_new_args.parse
|
tap_new_args.parse
|
||||||
|
|
||||||
raise "A tap argument is required" if ARGV.named.empty?
|
raise UsageError, "This command requires a tap argument" if ARGV.named.empty?
|
||||||
|
|
||||||
tap = Tap.fetch(ARGV.named.first)
|
tap = Tap.fetch(ARGV.named.first)
|
||||||
titleized_user = tap.user.dup
|
titleized_user = tap.user.dup
|
||||||
|
|||||||
@ -88,7 +88,7 @@ module Homebrew
|
|||||||
chdir "update-test" do
|
chdir "update-test" do
|
||||||
curdir = Pathname.new(Dir.pwd)
|
curdir = Pathname.new(Dir.pwd)
|
||||||
|
|
||||||
oh1 "Setup test environment..."
|
oh1 "Preparing test environment..."
|
||||||
# copy Homebrew installation
|
# copy Homebrew installation
|
||||||
safe_system "git", "clone", "#{HOMEBREW_REPOSITORY}/.git", ".",
|
safe_system "git", "clone", "#{HOMEBREW_REPOSITORY}/.git", ".",
|
||||||
"--branch", "master", "--single-branch"
|
"--branch", "master", "--single-branch"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user