githelp 0.3.4 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/githelp +24 -5
- data/lib/githelp/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0dfa9adad7bd2f69ed8ea736bd211e3709ccf32a86e1a98fa10677620c6ef4e4
|
4
|
+
data.tar.gz: b44b567936f41913773977f3331dbbeff6a462f5932ebd51a5f2d7aeffe83300
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a58961c4276d2d0082de92a82e1a06e5a3d368bc53bbd4f1384b4f8b4067d6a863856b757df2c51a93112c8eb19b64634e08ab12431116b7e0523fe264c822eb
|
7
|
+
data.tar.gz: e90623ed545071fc6a3f4f691f3bd1dc83a4989d649bdcc1c106357e29076e33e12f95eb0d3d38ef2177531360eb6ec761b6a18f7efc4684059a910280da2bc5
|
data/exe/githelp
CHANGED
@@ -33,6 +33,7 @@ class GitHelp
|
|
33
33
|
dumpdata = {}
|
34
34
|
dumpdata['codes'] = []
|
35
35
|
dumpdata['defs'] = []
|
36
|
+
dumpdata['pages'] = []
|
36
37
|
|
37
38
|
#
|
38
39
|
# 関数/定数を評価"
|
@@ -52,6 +53,7 @@ class GitHelp
|
|
52
53
|
puts "-----------------GitHelpデータを検出"
|
53
54
|
@pagedata.each { |title,pagedata|
|
54
55
|
puts "...#{title}"
|
56
|
+
dumpdata['pages'] << title
|
55
57
|
processing_defs = false
|
56
58
|
codeindent = nil
|
57
59
|
pagedata.each { |line|
|
@@ -74,7 +76,7 @@ class GitHelp
|
|
74
76
|
puts "'$'で始まる用例定義なしでコマンドを定義しようとしています"
|
75
77
|
exit
|
76
78
|
end
|
77
|
-
dumpdata['defs'] << line
|
79
|
+
dumpdata['defs'] << "#{line} {#{dumpdata['pages'].length-1}}"
|
78
80
|
processing_defs = true
|
79
81
|
else
|
80
82
|
processing_defs = false
|
@@ -89,6 +91,10 @@ class GitHelp
|
|
89
91
|
|
90
92
|
def githelp(pager)
|
91
93
|
data = JSON.parse(File.read(datafile))
|
94
|
+
unless data['pages'] # データ型式変換があったので
|
95
|
+
getdata
|
96
|
+
data = JSON.parse(File.read(datafile))
|
97
|
+
end
|
92
98
|
|
93
99
|
#
|
94
100
|
# 関数定義などをeval
|
@@ -129,21 +135,34 @@ class GitHelp
|
|
129
135
|
}
|
130
136
|
|
131
137
|
if pager == 'peco' then
|
138
|
+
no = {}
|
132
139
|
res = IO.popen(pager, "r+") {|io|
|
133
140
|
list.each_with_index { |entry,ind|
|
134
|
-
|
141
|
+
entry[0].sub!(/\s*{(\d*)}$/,'')
|
142
|
+
entry[1].sub!(/\s*{(\d*)}$/,'')
|
143
|
+
no[entry[0]] = $1.to_i
|
144
|
+
io.puts "[#{ind}] #{entry[0]}"
|
135
145
|
io.puts " #{entry[1]}"
|
136
146
|
}
|
137
147
|
io.close_write
|
138
148
|
io.gets
|
139
149
|
}
|
140
150
|
if res
|
141
|
-
if res =~
|
151
|
+
if res =~ /^\[(\d+)\]/
|
152
|
+
desc = list[$1.to_i][0]
|
142
153
|
cmd = list[$1.to_i][1]
|
143
154
|
else
|
155
|
+
desc = ''
|
156
|
+
list.each { |entry|
|
157
|
+
desc = entry[0] if entry[1].sub(/^\s*/,'') == res.chomp.sub(/^\s*/,'')
|
158
|
+
}
|
144
159
|
cmd = res.sub(/^\s*/,'')
|
145
160
|
end
|
146
|
-
|
161
|
+
|
162
|
+
puts "データ: http://scrapbox.io/GitHelp/#{data['pages'][no[desc]]}"
|
163
|
+
puts
|
164
|
+
puts "#{desc} ために"
|
165
|
+
print "コマンド「#{cmd.chomp}」 を実行しますか? (Y) "
|
147
166
|
ans = STDIN.gets
|
148
167
|
if ans =~ /^y/i || ans == "\n"
|
149
168
|
system cmd
|
@@ -152,7 +171,7 @@ class GitHelp
|
|
152
171
|
else
|
153
172
|
res = IO.popen(pager, "w") {|io|
|
154
173
|
list.each_with_index { |entry,ind|
|
155
|
-
io.puts "
|
174
|
+
io.puts "[#{ind}] #{entry[0]}"
|
156
175
|
io.puts " #{entry[1]}"
|
157
176
|
}
|
158
177
|
}
|
data/lib/githelp/version.rb
CHANGED