cmd: improve wording of messages, spacing
This commit is contained in:
parent
c246207ba0
commit
2f7c3afeb8
@ -42,7 +42,7 @@ module Homebrew
|
||||
when "regenerate-uuid"
|
||||
Utils::Analytics.regenerate_uuid!
|
||||
else
|
||||
raise UsageError
|
||||
raise UsageError, "Unknown subcommand."
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -20,12 +20,11 @@ module Homebrew
|
||||
|
||||
def command
|
||||
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)
|
||||
|
||||
path = Commands.path(cmd)
|
||||
|
||||
cmd_paths = PATH.new(ENV["PATH"]).append(Tap.cmd_directories) unless path
|
||||
path ||= which("brew-#{cmd}", cmd_paths)
|
||||
path ||= which("brew-#{cmd}.rb", cmd_paths)
|
||||
|
||||
@ -47,7 +47,6 @@ module Homebrew
|
||||
|
||||
def detect_version(path)
|
||||
version = path.version.to_s
|
||||
|
||||
raise "Couldn't determine version, set it with --version=<version>" if version.empty?
|
||||
|
||||
version
|
||||
|
||||
@ -61,22 +61,23 @@ module Homebrew
|
||||
|
||||
def info
|
||||
info_args.parse
|
||||
|
||||
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
|
||||
|
||||
if args.category.present?
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
elsif args.github?
|
||||
|
||||
@ -101,6 +101,7 @@ module Homebrew
|
||||
end
|
||||
|
||||
install_args.parse
|
||||
|
||||
raise FormulaUnspecifiedError if args.remaining.empty?
|
||||
|
||||
if args.ignore_dependencies?
|
||||
|
||||
@ -48,7 +48,10 @@ module Homebrew
|
||||
else
|
||||
keg.name
|
||||
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
|
||||
end
|
||||
|
||||
|
||||
@ -27,6 +27,7 @@ module Homebrew
|
||||
|
||||
def missing
|
||||
missing_args.parse
|
||||
|
||||
return unless HOMEBREW_CELLAR.exist?
|
||||
|
||||
ff = if ARGV.named.empty?
|
||||
|
||||
@ -41,7 +41,7 @@ module Homebrew
|
||||
ARGV.resolved_formulae
|
||||
end
|
||||
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)
|
||||
else
|
||||
|
||||
@ -27,6 +27,7 @@ module Homebrew
|
||||
|
||||
def sh
|
||||
sh_args.parse
|
||||
|
||||
ENV.activate_extensions!
|
||||
|
||||
if superenv?
|
||||
|
||||
@ -36,7 +36,7 @@ module Homebrew
|
||||
end
|
||||
|
||||
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))
|
||||
else
|
||||
|
||||
@ -79,7 +79,7 @@ module Homebrew
|
||||
if rack.directory?
|
||||
versions = rack.subdirs.map(&:basename)
|
||||
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
|
||||
@ -87,7 +87,7 @@ module Homebrew
|
||||
end
|
||||
rescue MultipleVersionsInstalledError => 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
|
||||
# If we delete Cellar/newname, then Cellar/oldname symlink
|
||||
# can become broken and we have to remove it.
|
||||
|
||||
@ -19,11 +19,11 @@ module Homebrew
|
||||
def untap
|
||||
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|
|
||||
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
|
||||
end
|
||||
|
||||
@ -314,7 +314,7 @@ homebrew-update() {
|
||||
*)
|
||||
odie <<EOS
|
||||
This command updates brew itself, and does not take formula names.
|
||||
Use 'brew upgrade $@' instead.
|
||||
Use \`brew upgrade $@\` instead.
|
||||
EOS
|
||||
;;
|
||||
esac
|
||||
@ -511,7 +511,7 @@ EOS
|
||||
if [[ "$UPSTREAM_SHA_HTTP_CODE" = "404" ]]
|
||||
then
|
||||
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
|
||||
echo "Fetching $DIR failed!" >>"$update_failed_file"
|
||||
fi
|
||||
|
||||
@ -219,7 +219,7 @@ module Homebrew
|
||||
return
|
||||
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
|
||||
|
||||
|
||||
@ -504,6 +504,6 @@ module Homebrew
|
||||
|
||||
formula.path.atomic_write(backup_file)
|
||||
FileUtils.mv alias_rename.last, alias_rename.first if alias_rename.present?
|
||||
odie "brew audit failed!"
|
||||
odie "`brew audit` failed!"
|
||||
end
|
||||
end
|
||||
|
||||
@ -98,7 +98,7 @@ module Homebrew
|
||||
extract_args.parse
|
||||
|
||||
# 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
|
||||
name = args.remaining.first.downcase
|
||||
|
||||
@ -21,7 +21,7 @@ module Homebrew
|
||||
def mirror
|
||||
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_key = ENV["HOMEBREW_BINTRAY_KEY"]
|
||||
|
||||
@ -70,7 +70,9 @@ module Homebrew
|
||||
|
||||
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
|
||||
ENV["GIT_COMMITTER_NAME"] = ENV["HOMEBREW_GIT_NAME"] if ENV["HOMEBREW_GIT_NAME"]
|
||||
@ -107,7 +109,7 @@ module Homebrew
|
||||
end
|
||||
_, testing_job = *testing_match
|
||||
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)
|
||||
_, user, repo, issue = *api_match
|
||||
url = "https://github.com/#{user}/#{repo}/pull/#{issue}"
|
||||
@ -277,7 +279,7 @@ module Homebrew
|
||||
elsif patch_changes[:formulae].length > 1
|
||||
odie "Can only bump one changed formula; bumped #{patch_changes[:formulae]}"
|
||||
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
|
||||
|
||||
|
||||
@ -21,7 +21,7 @@ module Homebrew
|
||||
def tap_new
|
||||
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)
|
||||
titleized_user = tap.user.dup
|
||||
|
||||
@ -88,7 +88,7 @@ module Homebrew
|
||||
chdir "update-test" do
|
||||
curdir = Pathname.new(Dir.pwd)
|
||||
|
||||
oh1 "Setup test environment..."
|
||||
oh1 "Preparing test environment..."
|
||||
# copy Homebrew installation
|
||||
safe_system "git", "clone", "#{HOMEBREW_REPOSITORY}/.git", ".",
|
||||
"--branch", "master", "--single-branch"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user