gitfinger 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/gitfinger +8 -4
- data/lib/gitfinger.rb +1 -1
- metadata +4 -4
data/bin/gitfinger
CHANGED
@@ -10,8 +10,8 @@ op = OptionParser.new {|o|
|
|
10
10
|
o.banner = "Usage: gitfinger [GitHub username]"
|
11
11
|
o.separator ""
|
12
12
|
o.separator "Specific options:"
|
13
|
-
o.on("-s", "--sort
|
14
|
-
o.on("-r", "--reverse", "Reverse
|
13
|
+
o.on("-s", "--sort FIELD", "Sort on FIELD; you can try to abbreviate FIELD") { |field| opts[:sort] = field }
|
14
|
+
o.on("-r", "--reverse", "Reverse default order") { opts[:reverse] = true }
|
15
15
|
o.on("-H", "--no-header", "Suppress header and prefix repo name with user") {
|
16
16
|
opts[:noheader] = true
|
17
17
|
}
|
@@ -48,8 +48,12 @@ def truncate(s, len)
|
|
48
48
|
s.length > len ? s[0,len-3] + '...' : s
|
49
49
|
end
|
50
50
|
|
51
|
+
# first of each pair is displayed, the 2nd is the corresponding GitHub API key
|
52
|
+
KEYS = %w( repo name w watchers f forks i open_issues updated updated_at pushed pushed_at type fork desc description )
|
53
|
+
COLUMNS = KEYS.each_slice(2).map(&:first)
|
54
|
+
|
51
55
|
res = repos.map {|r|
|
52
|
-
d =
|
56
|
+
d = KEYS.each_slice(2).reduce({}) {|m, (display_key,api_key)|
|
53
57
|
m[display_key] = r[api_key]
|
54
58
|
m
|
55
59
|
}
|
@@ -59,7 +63,7 @@ res = repos.map {|r|
|
|
59
63
|
d
|
60
64
|
}
|
61
65
|
|
62
|
-
sort_field = opts[:sort]
|
66
|
+
sort_field = opts[:sort] ? COLUMNS.detect {|c| c =~ /^#{opts[:sort]}/} : 'updated'
|
63
67
|
res = res.sort_by {|x|
|
64
68
|
sort_value = x[sort_field]
|
65
69
|
if sort_value.nil?
|
data/lib/gitfinger.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitfinger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-01-
|
12
|
+
date: 2012-01-28 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: octokit
|
16
|
-
requirement: &
|
16
|
+
requirement: &70361639143180 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: '0.6'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70361639143180
|
25
25
|
description: Finger GitHub users
|
26
26
|
email:
|
27
27
|
- dhchoi@gmail.com
|