diff --git a/Library/Homebrew/cmd/diy.rb b/Library/Homebrew/cmd/diy.rb index a2cdf6c1fa..c4b892a6c7 100644 --- a/Library/Homebrew/cmd/diy.rb +++ b/Library/Homebrew/cmd/diy.rb @@ -9,15 +9,36 @@ #: installing. require "formula" +require "cli_parser" module Homebrew module_function + def diy_args + Homebrew::CLI::Parser.new do + usage_banner <<~EOS + `diy` [] + + Automatically determine the installation prefix for non-Homebrew software. + Using the output from this command, you can install your own software into + the Cellar and then link it into Homebrew's prefix with `brew link`. + EOS + flag "--name=", + description: "Explicitly set the provided of the package being installed." + flag "--version=", + description: "Explicitly set the provided of the package being installed." + switch :verbose + switch :debug + end + end + def diy + diy_args.parse + path = Pathname.getwd - version = ARGV.value("version") || detect_version(path) - name = ARGV.value("name") || detect_name(path, version) + version = args.version || detect_version(path) + name = args.name || detect_name(path, version) prefix = HOMEBREW_CELLAR/name/version