File: help.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 (27 lines) | stat: -rw-r--r-- 653 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
25
26
27
module TicGitNG
  module Command
    # Shows help for ticgit or a particular command
    #
    # Usage:
    # ti help               (show help for ticgit)
    # ti help {command}     (show help for specified command)
    module Help
      def parser(opts)
        opts.banner = "Usage: ti help [command]\n"
      end
      def execute
        cli = CLI.new([])
        if ARGV.length >= 2 # ti help {command}
          action = ARGV[1]
          if command = Command.get(action)
            cli.extend(command)
          else
            puts "Unknown command #{action}\n\n"
          end
        end
        puts cli.usage
      end
    end
  end
end