Sha256: 0d43cbb5e07319d39b2223911f8c7fbfae1c57575473d33332c63453c87f6d1b

Contents?: true

Size: 1003 Bytes

Versions: 12

Compression:

Stored size: 1003 Bytes

Contents

require 'collins_shell/thor'
require 'collins_shell/util'
require 'thor'
require 'thor/group'

module CollinsShell

  class Tag < Thor

    include ThorHelper
    include CollinsShell::Util
    namespace :tag

    def self.banner task, namespace = true, subcommand = false
      "#{basename} #{task.formatted_usage(self, true, subcommand).gsub(':',' ')}"
    end

    desc 'list', 'list tags that are in use'
    use_collins_options
    def list
      call_collins get_collins_client, "list" do |client|
        header = [["Name", "Label", "Description"]]
        tags = header + client.get_all_tags.map do |tag|
          [tag.name, tag.label, tag.description]
        end
        print_table tags
      end
    end

    desc 'values TAG', 'list all values for the specified tag'
    use_collins_options
    def values tag
      call_collins get_collins_client, "values" do |client|
        client.get_tag_values(tag).sort.each do |value|
          puts(value)
        end
      end
    end
  end

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
collins_shell-0.2.26 lib/collins_shell/tag.rb
collins_shell-0.2.24 lib/collins_shell/tag.rb
collins_shell-0.2.23 lib/collins_shell/tag.rb
collins_shell-0.2.22 lib/collins_shell/tag.rb
collins_shell-0.2.21 lib/collins_shell/tag.rb
collins_shell-0.2.20 lib/collins_shell/tag.rb
collins_shell-0.2.19 lib/collins_shell/tag.rb
collins_shell-0.2.18 lib/collins_shell/tag.rb
collins_shell-0.2.17 lib/collins_shell/tag.rb
collins_shell-0.2.16 lib/collins_shell/tag.rb
collins_shell-0.2.15 lib/collins_shell/tag.rb
collins_shell-0.2.14 lib/collins_shell/tag.rb