stephencelis-ghi 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/History.rdoc CHANGED
@@ -1,3 +1,11 @@
1
+ === 0.1.5 / 2009-05-15
2
+
3
+ * 2 bugfixes
4
+
5
+ * Long titles should wrap in show/verbose issue view.
6
+ * If a non-OptionParser argument fails early, re-parse when valid.
7
+
8
+
1
9
  === 0.1.4 / 2009-05-15
2
10
 
3
11
  * 1 minor enhancement
data/lib/ghi/cli.rb CHANGED
@@ -118,13 +118,13 @@ module GHI::CLI #:nodoc:
118
118
 
119
119
  def show_format(issue, verbose = true)
120
120
  l = []
121
- l << " number: #{issue.number}" if issue.number
122
- l << " state: #{issue.state}" if issue.state
123
- l << " title: #{issue.title}" if issue.title
121
+ l << " number: #{issue.number}" if issue.number
122
+ l << " state: #{issue.state}" if issue.state
123
+ l << " title: #{indent(issue.title, 15, 0)}" if issue.title
124
124
  l << " user: #{issue.user || GHI.login}"
125
- l << " votes: #{issue.votes}" if issue.votes
126
- l << " created at: #{issue.created_at}" if issue.created_at
127
- l << " updated at: #{issue.updated_at}" if issue.updated_at
125
+ l << " votes: #{issue.votes}" if issue.votes
126
+ l << " created at: #{issue.created_at}" if issue.created_at
127
+ l << " updated at: #{issue.updated_at}" if issue.updated_at
128
128
  return l unless verbose
129
129
  l << ""
130
130
  l += indent(issue.body)[0..-2]
@@ -141,10 +141,12 @@ module GHI::CLI #:nodoc:
141
141
  result
142
142
  end
143
143
 
144
- def indent(string, level = 4)
145
- string.scan(/.{0,#{79 - level}}(?:\s|\Z)/).map { |line|
144
+ def indent(string, level = 4, first = level)
145
+ lines = string.scan(/.{0,#{79 - level}}(?:\s|\Z)/).map { |line|
146
146
  " " * level + line
147
147
  }
148
+ lines.first.sub!(/^\s+/) {} if first != level
149
+ lines
148
150
  end
149
151
 
150
152
  private
@@ -204,7 +206,7 @@ module GHI::CLI #:nodoc:
204
206
  :action, :search_term, :number, :title, :body, :tag, :args, :verbosity
205
207
 
206
208
  def parse!(*argv)
207
- @args = argv
209
+ @args, @argv = argv, argv.dup
208
210
 
209
211
  repo_expression = %r{([^:/]+)/([^/\.\s]+)(?:\.git)?$}
210
212
  `git config --get remote.origin.url`.match repo_expression
@@ -555,7 +557,7 @@ module GHI::CLI #:nodoc:
555
557
  @search_term ||= arguments.shift
556
558
  when "show", /^-?(\d+)$/
557
559
  @action = :show
558
- @number ||= ($1 || arguments.shift[/\d+/].to_i)
560
+ @number ||= ($1 || arguments.shift[/\d+/]).to_i
559
561
  when "open"
560
562
  @action = :open
561
563
  when "edit"
@@ -585,7 +587,12 @@ module GHI::CLI #:nodoc:
585
587
  @action = :list
586
588
  @user, @repo = $1, $2
587
589
  end
588
- return true if @action
590
+ if @action
591
+ @args = @argv.dup
592
+ args.delete_if { |arg| arg == command }
593
+ option_parser.parse!(*args)
594
+ return true
595
+ end
589
596
  unless command.start_with? "-"
590
597
  warn "#{File.basename $0}: what do you mean, '#{command}'?"
591
598
  end
data/lib/ghi.rb CHANGED
@@ -2,7 +2,7 @@ require "net/http"
2
2
  require "yaml"
3
3
 
4
4
  module GHI
5
- VERSION = "0.1.4"
5
+ VERSION = "0.1.5"
6
6
 
7
7
  def self.login
8
8
  return @login if defined? @login
data/spec/ghi/cli_spec.rb CHANGED
@@ -159,6 +159,11 @@ describe GHI::CLI::Executable do
159
159
  @action, @state, @user, @repo = :list, :open, "remoteuser", "remoterepo"
160
160
  end
161
161
 
162
+ it "should parse -rremoteuser/remoterepo as a later argument" do
163
+ @args = ["-1", "-rremoteuser/remoterepo"]
164
+ @action, @number, @user, @repo = :show, 1, "remoteuser", "remoterepo"
165
+ end
166
+
162
167
  it "should parse -t2 'tag' as label issue 2 with 'tag'" do
163
168
  @args = ["-t2", "tag"]
164
169
  @action, @number, @tag = :label, 2, "tag"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stephencelis-ghi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen Celis
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-05-15 00:00:00 -07:00
12
+ date: 2009-07-08 00:00:00 -07:00
13
13
  default_executable: ghi
14
14
  dependencies: []
15
15