Class: Trellor::Cli

Inherits:
Object
  • Object
show all
Defined in:
lib/cli.rb

Class Method Summary collapse

Class Method Details

.parseObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/cli.rb', line 6

def self.parse
  logger.info "$ trellor #{ARGV.join(' ')}"

  @opts = Trollop::options do
    banner "Usage: trellor [boardname [listname [cardname [description]]]]"
    version "trellor #{VERSION}"
    opt :archive, 'Archive a card', short: '-a'
    opt :cache, 'Cache (or re-cache)', short: '-c'
    opt :verbose, 'Run verbosely', short: '-v'
    opt :webapi, 'Run webapi', short: '-w'
    opt :slowtrellor, 'Make own connection rather than using webapi', short: '-s'
  end

  set_verbosity

  if webapi?
    require_relative 'web_trellor'
    web = WebTrellor.new
    # web.be_verbose = true if verbose?
    web.ensure_webapp_is_running(false)
    exit 0
  end

  if cache?
    hash = save_all
    p hash
  end

  query_trellor(*ARGV)
end