stephencelis-ghi 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/History.rdoc +9 -0
  2. data/lib/ghi/cli.rb +50 -50
  3. data/lib/ghi.rb +1 -1
  4. metadata +2 -2
data/History.rdoc CHANGED
@@ -1,3 +1,12 @@
1
+ === 0.1.3 / 2009-05-08
2
+
3
+ * 1 minor enhancement
4
+
5
+ * Fix bug where `more' was being passed `less' options.
6
+ * Fix scoping of commands so `ghi user/repo` can run outside of a repo
7
+ directory.
8
+
9
+
1
10
  === 0.1.2 / 2009-05-07
2
11
 
3
12
  * 1 major enhancement
data/lib/ghi/cli.rb CHANGED
@@ -174,14 +174,16 @@ module GHI::CLI #:nodoc:
174
174
  end
175
175
 
176
176
  def prepare_stdout
177
- return if @prepared || @no_pager || !$stdout.isatty
177
+ return if @prepared || @no_pager || !$stdout.isatty || pager.nil?
178
178
  colorize? # Check for colorization.
179
- $stdout = IO.popen pager, "w"
179
+ $stdout = pager
180
180
  @prepared = true
181
181
  end
182
182
 
183
183
  def pager
184
- ENV["GHI_PAGER"] || "more -EMR"
184
+ return @pager if defined? @pager
185
+ pagers = [ENV["GHI_PAGER"], "less -EMRX", "pager", "more"].compact.uniq
186
+ pagers.each { |pager| return @pager = IO.popen(pager, "w") rescue nil }
185
187
  end
186
188
  end
187
189
 
@@ -529,54 +531,52 @@ module GHI::CLI #:nodoc:
529
531
  # overcome this.
530
532
  #+
531
533
  def fallback_parsing(*arguments)
532
- if user && repo
533
- arguments = arguments.flatten
534
- case command = arguments.shift
535
- when nil, "list"
536
- @action = :list
537
- if arg = arguments.shift
538
- @state ||= arg.to_sym if %w(open closed).include? arg
539
- @user, @repo = arg.split "/" if arg.count("/") == 1
540
- end
541
- when "search"
542
- @action = :search
543
- @search_term ||= arguments.shift
544
- when "show", /^-?(\d+)$/
545
- @action = :show
546
- @number ||= ($1 || arguments.shift[/\d+/].to_i)
547
- when "open"
548
- @action = :open
549
- when "edit"
550
- @action = :edit
551
- @number ||= arguments.shift[/\d+/].to_i
552
- when "close"
553
- @action = :close
554
- @number ||= arguments.shift[/\d+/].to_i
555
- when "reopen"
556
- @action = :reopen
557
- @number ||= arguments.shift[/\d+/].to_i
558
- when "label"
559
- @action = :label
560
- @number ||= arguments.shift[/\d+/].to_i
561
- @label ||= arguments.shift
562
- when "unlabel"
563
- @action = :unlabel
564
- @number ||= arguments.shift[/\d+/].to_i
565
- @label ||= arguments.shift
566
- when "comment"
567
- @action = :comment
568
- @number ||= arguments.shift[/\d+/].to_i
569
- when "claim"
570
- @action = :claim
571
- @number ||= arguments.shift[/\d+/].to_i
572
- when %r{^([^/]+)/([^/]+)$}
573
- @action = :list
574
- @user, @repo = $1, $2
575
- end
576
- return true if @action
577
- unless command.start_with? "-"
578
- warn "#{File.basename $0}: what do you mean, '#{command}'?"
534
+ arguments = arguments.flatten
535
+ case command = arguments.shift
536
+ when nil, "list"
537
+ @action = :list
538
+ if arg = arguments.shift
539
+ @state ||= arg.to_sym if %w(open closed).include? arg
540
+ @user, @repo = arg.split "/" if arg.count("/") == 1
579
541
  end
542
+ when "search"
543
+ @action = :search
544
+ @search_term ||= arguments.shift
545
+ when "show", /^-?(\d+)$/
546
+ @action = :show
547
+ @number ||= ($1 || arguments.shift[/\d+/].to_i)
548
+ when "open"
549
+ @action = :open
550
+ when "edit"
551
+ @action = :edit
552
+ @number ||= arguments.shift[/\d+/].to_i
553
+ when "close"
554
+ @action = :close
555
+ @number ||= arguments.shift[/\d+/].to_i
556
+ when "reopen"
557
+ @action = :reopen
558
+ @number ||= arguments.shift[/\d+/].to_i
559
+ when "label"
560
+ @action = :label
561
+ @number ||= arguments.shift[/\d+/].to_i
562
+ @label ||= arguments.shift
563
+ when "unlabel"
564
+ @action = :unlabel
565
+ @number ||= arguments.shift[/\d+/].to_i
566
+ @label ||= arguments.shift
567
+ when "comment"
568
+ @action = :comment
569
+ @number ||= arguments.shift[/\d+/].to_i
570
+ when "claim"
571
+ @action = :claim
572
+ @number ||= arguments.shift[/\d+/].to_i
573
+ when %r{^([^/]+)/([^/]+)$}
574
+ @action = :list
575
+ @user, @repo = $1, $2
576
+ end
577
+ return true if @action
578
+ unless command.start_with? "-"
579
+ warn "#{File.basename $0}: what do you mean, '#{command}'?"
580
580
  end
581
581
  end
582
582
  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.0"
5
+ VERSION = "0.1.3"
6
6
 
7
7
  def self.login
8
8
  return @login if defined? @login
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.2
4
+ version: 0.1.3
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-07 00:00:00 -07:00
12
+ date: 2009-05-08 00:00:00 -07:00
13
13
  default_executable: ghi
14
14
  dependencies: []
15
15