-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
chrislo
committed
Dec 4, 2009
1 parent
56cbf42
commit 2309f00
Showing
2 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env ruby | ||
|
||
require 'rubygems' | ||
|
||
# require 'jira' | ||
require File.dirname(__FILE__) + '/../lib/jira' | ||
|
||
Jira::CLI.execute |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
require 'optparse' | ||
|
||
module Jira | ||
class CLI | ||
attr_reader :action, :options, :args | ||
|
||
def self.execute | ||
parse(ARGV).execute! | ||
end | ||
|
||
def self.parse(args) | ||
cli = new(args) | ||
cli.parse_options! | ||
cli.load_global_options | ||
cli | ||
end | ||
|
||
def initialize(args) | ||
@args = args.dup | ||
end | ||
|
||
def execute! | ||
case action | ||
when 'list': | ||
handle_ticket_list | ||
else | ||
puts 'not a command' | ||
end | ||
end | ||
|
||
def parse_options! | ||
if args.empty? | ||
warn "Please specify at least one action to execute." | ||
puts " list" | ||
exit | ||
end | ||
|
||
@action = args.first | ||
end | ||
end | ||
end |