Sha256: b60d5c13c10566a8585f2adbcd395190c94bbd50adc901854e2272ada72f2057

Contents?: true

Size: 1.02 KB

Versions: 2

Compression:

Stored size: 1.02 KB

Contents

# frozen_string_literal: true

desc "Remove a nickname"
command :remove do |remove|
  remove.desc "Removes a nickname from a friend"
  remove.arg_name "NAME NICKNAME"
  remove.command :nickname do |remove_nickname|
    remove_nickname.action do |_, _, args|
      @introvert.remove_nickname(name: args.first, nickname: args[1])
      @dirty = true # Mark the file for cleaning.
    end
  end

  remove.desc "Removes an alias from a location"
  remove.arg_name "LOCATION ALIAS"
  remove.command :alias do |remove_alias|
    remove_alias.action do |_, _, args|
      @introvert.remove_alias(name: args.first.to_s.strip, nickname: args[1].to_s.strip)
      @dirty = true # Mark the file for cleaning.
    end
  end

  remove.desc "Removes a tag from a friend"
  remove.arg_name "NAME @TAG"
  remove.command :tag do |remove_tag|
    remove_tag.action do |_, _, args|
      @introvert.remove_tag(
        name: args[0..-2].join(" "),
        tag: Tag.convert_to_tag(args.last)
      )
      @dirty = true # Mark the file for cleaning.
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
friends-0.55 lib/friends/commands/remove.rb
friends-0.54 lib/friends/commands/remove.rb