Sha256: d9d9f80ba97757e87d201fbe6c7a1ab96c1cec329c777afcff26b7fdcc1b2dd2

Contents?: true

Size: 1.17 KB

Versions: 4

Compression:

Stored size: 1.17 KB

Contents

module Jets::Thor
  # Not naming Options to avoid conflict with Thor::Options
  module SharedOptions
    extend ActiveSupport::Concern
    module ClassMethods
      def paging_options(defaults = {})
        option :limit, default: defaults[:limit] || 25, aliases: :l, type: :numeric, desc: "Per page limit"
        option :order, default: defaults[:order] || "asc", aliases: :o, desc: "Order: asc or desc"
        option :page, aliases: :p, type: :numeric, desc: "Page number"
      end

      def yes_option
        option :yes, aliases: :y, type: :boolean, desc: "Skip are you sure prompt"
      end

      def format_option(defaults = {})
        default = defaults[:default] || "table"
        option :format, default: default, desc: "Output format: #{CliFormat.formats.join(", ")}"
      end

      def verbose_option
        option :verbose, aliases: :v, default: false, type: :boolean, desc: "Show more verbose logging output. Useful for debugging what's under the hood"
      end

      def function_name_option(defaults = {})
        default = defaults[:default] || "controller"
        option :function, aliases: :n, default: default, desc: "Lambda Function name"
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
jets-6.0.5 lib/jets/thor/shared_options.rb
jets-6.0.4 lib/jets/thor/shared_options.rb
jets-6.0.3 lib/jets/thor/shared_options.rb
jets-6.0.2 lib/jets/thor/shared_options.rb