lib/command/base.rb in cpl-0.2.0 vs lib/command/base.rb in cpl-0.3.0

- old
+ new

@@ -1,10 +1,10 @@ # frozen_string_literal: true module Command class Base # rubocop:disable Metrics/ClassLength - attr_reader :thor_shell, :config + attr_reader :config # Used to call the command (`cpl NAME`) # NAME = "" # Displayed when running `cpl help` or `cpl help NAME` (defaults to `NAME`) USAGE = "" @@ -25,11 +25,10 @@ HIDE = false NO_IMAGE_AVAILABLE = "NO_IMAGE_AVAILABLE" def initialize(config) - @thor_shell = Thor::Shell::Color.new @config = config end def self.all_commands Dir["#{__dir__}/*.rb"].each_with_object({}) do |file, result| @@ -96,9 +95,22 @@ name: :yes, params: { aliases: ["-y"], banner: "SKIP_CONFIRM", desc: "Skip confirmation", + type: :boolean, + required: required + } + } + end + + def self.version_option(required: false) + { + name: :version, + params: { + aliases: ["-v"], + banner: "VERSION", + desc: "Displays the current version of the CLI", type: :boolean, required: required } } end