Sha256: d6e1af4eb0af66cc0a773e9f746593e1d0de62d78985a34259f7b1e2ed5117e9

Contents?: true

Size: 879 Bytes

Versions: 5

Compression:

Stored size: 879 Bytes

Contents

# frozen_string_literal: true

require_relative 'model'
require_relative 'fixture'

class App
  desc 'Manage countries'
  command :country do |c|
    c.desc 'List countries'
    c.command :list do |l|
      l.flag :country_code
      l.action do |_global_options, options, _args|
        country_code = options[:country_code]
        App.db.all(Country).each do |country|
          next if country_code && country.code != country_code

          puts country
        end
      end
    end

    # c.desc 'Delete countries'
    # c.command :delete do |d|
    #   d.desc 'Shared country unique ID'
    #   d.flag [:id]

    #   d.action do |_global_options, options, _args|
    #     id = options[:id]
    #     puts "Delete country ##{id} ..."
    #     # countrys = fetch_countrys(from: source)
    #     # countrys.each { |country| puts country }
    #   end
    # end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
avs-0.1.3 lib/domain/country/command.rb
avs-0.1.2 lib/domain/country/command.rb
avs-0.1.1 lib/domain/country/command.rb
avs-0.1.0 lib/domain/country/command.rb
avs-0.0.9 lib/domain/country/command.rb