stephencelis-ghi 0.1.1 → 0.1.2

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 +10 -1
  2. data/README.rdoc +7 -4
  3. data/lib/ghi/cli.rb +51 -3
  4. metadata +2 -2
data/History.rdoc CHANGED
@@ -1,4 +1,13 @@
1
- === 0.1.1 / 2009-05/01
1
+ === 0.1.2 / 2009-05-07
2
+
3
+ * 1 major enhancement
4
+
5
+ * Better fallbacks. Enter `ghi open`, `ghi list closed`, `ghi search term`,
6
+ `ghi show 2`, `ghi user/repo`, etc., it will try to work. Fallbacks do not
7
+ accept options, though.
8
+
9
+
10
+ === 0.1.1 / 2009-05-01
2
11
 
3
12
  * 3 major enhancements
4
13
 
data/README.rdoc CHANGED
@@ -18,6 +18,7 @@ Go:
18
18
  Usage: ghi [options]
19
19
  -l, --list [state|term|number]
20
20
  --search, --show
21
+ -v, --verbose
21
22
  -o, --open [title|number]
22
23
  --reopen
23
24
  -c, --closed, --close [number]
@@ -27,8 +28,9 @@ Go:
27
28
  -t, --label [number] [label]
28
29
  --claim [number]
29
30
  -d, --unlabel [number] [label]
30
- -u, --url [number]
31
- --[no-]colors
31
+ -u, --url [state|number]
32
+ --[no-]color
33
+ --[no-]pager
32
34
  -V, --version
33
35
  -h, --help
34
36
 
@@ -65,8 +67,9 @@ ghi works simply from within a repository. Some short examples:
65
67
 
66
68
  ghi also works anywhere:
67
69
 
68
- ghi -rghi -l # Your fork of "ghi"
69
- ghi -rstephencelis/ghi -l # Mine: "stephencelis/ghi"
70
+ ghi -rghi # Your fork of "ghi"
71
+ ghi -rstephencelis/ghi # Mine: "stephencelis/ghi"
72
+ ghi stephencelis/ghi # Shorthand to merely list open.
70
73
 
71
74
 
72
75
  ghi uses ANSI colors if you use them in git.
data/lib/ghi/cli.rb CHANGED
@@ -521,13 +521,61 @@ module GHI::CLI #:nodoc:
521
521
  defined?(Launchy) ? Launchy.open(url) : puts(url)
522
522
  end
523
523
 
524
+ #-
525
+ # Because these are mere fallbacks, any options used earlier will muddle
526
+ # things: `ghi list` will work, `ghi list -c` will not.
527
+ #
528
+ # Argument parsing will have to better integrate with option parsing to
529
+ # overcome this.
530
+ #+
524
531
  def fallback_parsing(*arguments)
525
532
  if user && repo
526
- if arguments.to_s.empty?
533
+ arguments = arguments.flatten
534
+ case command = arguments.shift
535
+ when nil, "list"
527
536
  @action = :list
528
- elsif arguments.to_s =~ /^-?(\d+)$/
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+)$/
529
545
  @action = :show
530
- @number = $1
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}'?"
531
579
  end
532
580
  end
533
581
  end
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.1
4
+ version: 0.1.2
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-01 00:00:00 -07:00
12
+ date: 2009-05-07 00:00:00 -07:00
13
13
  default_executable: ghi
14
14
  dependencies: []
15
15