# frozen_string_literal: true require "thor" module Boilercode # Handle the application command line parsing # and the dispatch to various command objects # # @api public class CLI < Thor # Error raised by this runner Error = Class.new(StandardError) desc "version", "boilercode version" def version require_relative "version" puts "v#{Boilercode::VERSION}" end map %w[--version -v] => :version require_relative "commands/drive" register Boilercode::Commands::Drive, "drive", "drive [SUBCOMMAND]", "Manage your file uploads" require_relative "commands/bookmarks" register Boilercode::Commands::Bookmarks, "bookmarks", "bookmarks [SUBCOMMAND]", "Manage your bookmarks" require_relative "commands/snippets" register Boilercode::Commands::Snippets, "snippets", "snippets [SUBCOMMAND]", "Manage your snippets" desc "news", "Command description..." method_option :help, aliases: "-h", type: :boolean, desc: "Display usage information" def news(*) if options[:help] invoke :help, ["news"] else require_relative "commands/news" Boilercode::Commands::News.new(options).execute end end desc "login", "Authenticate with Boilercode.io" method_option :help, aliases: "-h", type: :boolean, desc: "Display usage information" def login(*) if options[:help] invoke :help, ["login"] else require_relative "commands/login" Boilercode::Commands::Login.new.execute end end end end