File: tag.rb

package info (click to toggle)
ticgit 1.0.2.18-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 488 kB
  • sloc: ruby: 2,848; sh: 124; makefile: 16
file content (24 lines) | stat: -rw-r--r-- 647 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
module TicGitNG
  module Command
    module Tag
      def parser(opts)
        opts.banner = "Usage: ti tag [tic_id] [options] [tag_name] "
        opts.on_head(
          "-d", "--delete",
          "Remove this tag from the ticket"){|v| options.remove = v }
      end

      def execute
        if args.size > 1 # `ti tag 1234abc tagname1`
          tic.ticket_tag(args[1], args[0].chomp, options)
        elsif args.size == 1 # `ti tag tagname1`
          tic.ticket_tag(args[0], nil, options)
        else
          puts 'You need to at least specify one tag to add'
          puts
          puts usage
        end
      end
    end
  end
end