From 6399ee19cbc924b25fce3ddbc5d347fbc05bb75d Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Mon, 3 Feb 2020 16:37:23 +0100 Subject: [PATCH] cmd: use CLI::Parser. Migrate all commands to use CLI::Parser. --- cmd/aspell-dictionaries.rb | 61 +++++++++ cmd/brew-aspell-dictionaries.rb | 45 ------- cmd/brew-postgresql-upgrade-database.rb | 143 --------------------- cmd/postgresql-upgrade-database.rb | 163 ++++++++++++++++++++++++ 4 files changed, 224 insertions(+), 188 deletions(-) create mode 100755 cmd/aspell-dictionaries.rb delete mode 100755 cmd/brew-aspell-dictionaries.rb delete mode 100755 cmd/brew-postgresql-upgrade-database.rb create mode 100755 cmd/postgresql-upgrade-database.rb diff --git a/cmd/aspell-dictionaries.rb b/cmd/aspell-dictionaries.rb new file mode 100755 index 00000000000..9d857b8f142 --- /dev/null +++ b/cmd/aspell-dictionaries.rb @@ -0,0 +1,61 @@ +require "cli/parser" +require "open-uri" +require "resource" +require "formula" + +module Homebrew + module_function + + def aspell_dictionaries_args + Homebrew::CLI::Parser.new do + usage_banner <<~EOS + `aspell-dictionaries` + + Generates the new dictionaries for the `aspell` formula. + EOS + end + end + + def aspell_dictionaries + aspell_dictionaries_args.parse + + dict_url = "https://ftp.gnu.org/gnu/aspell/dict" + dict_mirror = "https://ftpmirror.gnu.org/aspell/dict" + + languages = {} + + URI.parse("#{dict_url}/0index.html").open do |content| + content.each_line do |line| + break if %r{^