class SubCommands::Tags
Public Instance Methods
add(tag)
click to toggle source
# File lib/subcommands/tags.rb, line 4 def add(tag) tag = ::Tag.new(tag: tag.strip) if !tag.save output do tag.errors.full_messages.each do |error| say error, :red end end exit end output do say tag.tag + " added!", :green end end
ls()
click to toggle source
# File lib/subcommands/tags.rb, line 37 def ls tags = ::Tag.order(options[:order].to_sym => :desc) if tags.size == 0 output do say "No tags found", :red end end table = [['#', 'name', 'logs']] # header tags.each do |tag| table << [tag.id, tag.tag, tag.logs.count] # row end output do print_table table end end
rm(tag)
click to toggle source
option :prune, :type => :boolean, :alias => '-p', :default => false not implemented yet
# File lib/subcommands/tags.rb, line 23 def rm(tag) tag = ::Tag.find_by!(tag: tag) output do if tag.destroy say "Tag #{tag.tag} destroyed forever", :green else say "Tag #{tag.tag} could not be destroyed", :red end end end