helpline 0.1.14 → 0.2.1
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.
- checksums.yaml +4 -4
- data/00README +8 -1
- data/HelpLine.json +1690 -0
- data/Makefile +10 -46
- data/Makefile.electron +43 -0
- data/exe/helpline +28 -249
- data/index.html +32 -42
- data/keydef.zsh +1 -1
- data/lib/helpline/curses.rb +7 -0
- data/lib/helpline/generate.rb +76 -0
- data/lib/helpline/helpline.rb +8 -0
- data/lib/helpline/run.rb +97 -0
- data/lib/helpline/update.rb +111 -0
- data/lib/helpline/version.rb +1 -1
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b1990a34e246aa29e6f04d43d72541dc2dea4a1a9051f96541ce4d1b161006b
|
4
|
+
data.tar.gz: c09e2c0ab0e5ad4d3848c7a4b1a6ab37913e8990f96bc0f260b2e8cfd719aac8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58cdbfd97c3030da1ef9f496ccd85efc5429693b276d87e95a61059a7a0edbcabee793fd9b6ae0f278e4a8f36de707853e071c4846998d64b90199e1c5d92e1a
|
7
|
+
data.tar.gz: 04f66e3949c0d9aa0a9e96b83fc68da053825f1ad5ec25d3c177f8f8c180aa4fbcc059bda63350f70c5838111407f5b22cced14e1df1cbe1cd1b986cf747c6ba
|
data/00README
CHANGED
data/HelpLine.json
ADDED
@@ -0,0 +1,1690 @@
|
|
1
|
+
{
|
2
|
+
"name": "HelpLine",
|
3
|
+
"displayName": "HelpLine",
|
4
|
+
"exported": 1593960843,
|
5
|
+
"pages": [
|
6
|
+
{
|
7
|
+
"title": "HelpLine",
|
8
|
+
"created": 1593393132,
|
9
|
+
"updated": 1593782390,
|
10
|
+
"id": "5ef93fecff820f001eacf5be",
|
11
|
+
"lines": [
|
12
|
+
"HelpLine",
|
13
|
+
"[* 概要]",
|
14
|
+
" `zsh` でコマンド入力中にCtrl-Jを入力するとヘルプウィンドウが表示され、機能を選んでコマンド実行させることができます",
|
15
|
+
" 覚えるのが大変な複雑なコマンドでも実行できます",
|
16
|
+
" Gem版とElectron版があります",
|
17
|
+
" Gem版がおすすめ",
|
18
|
+
" Electron版の動作",
|
19
|
+
" [https://s3-ap-northeast-1.amazonaws.com/masui.org/d/b/db555e8535ff111e794b95e6d3d7a8f5.mp4]",
|
20
|
+
"",
|
21
|
+
"[** Gem版]",
|
22
|
+
" `% gem install helpline` でインストール",
|
23
|
+
" `~/.zshrc`に以下を追加します",
|
24
|
+
" `~/.zshrc`に以下のように記述を追加します",
|
25
|
+
" `helpline`のパスは適当に設定",
|
26
|
+
" code:.zshrc",
|
27
|
+
" function run-help() {",
|
28
|
+
" /usr/local/bin/helpline \"${BUFFER}\" < $TTY",
|
29
|
+
" BUFFER=$(cat /tmp/helpline.cmd)",
|
30
|
+
" CURSOR=${#BUFFER}",
|
31
|
+
" zle redisplay",
|
32
|
+
" }",
|
33
|
+
" zle -N run-help",
|
34
|
+
" bindkey \"^j\" run-help",
|
35
|
+
" 初回は`% helpline -u` でデータをScrapboxから取得します",
|
36
|
+
" `~/.helpline.json`に格納されます",
|
37
|
+
" その後は、gitレポジトリのディレクトリで `% ignore` などと入力した後で[[Ctrl-Jを押すとヘルプメニューが表示されます]]",
|
38
|
+
" [https://gyazo.com/b6607048224beb466a08d49194ab1188]",
|
39
|
+
" Ctrl-P, Ctrl-Nなどで目的の行に移動してリターンキーを押すとコマンドが展開されます",
|
40
|
+
" [https://gyazo.com/d5f9d853e21df13829021f816dc0ec8a]",
|
41
|
+
" ここでリターンを押すとコマンドが実行されます",
|
42
|
+
" 「鎌倉」とか「ラーメン」とか入力してCtrl-Jを押してもメニューが出ます",
|
43
|
+
" [https://gyazo.com/eb19a3cf6900ce52281d5a4158301b8a]",
|
44
|
+
"",
|
45
|
+
"",
|
46
|
+
"[** Electron版]",
|
47
|
+
" [* インストール] (Macの場合)",
|
48
|
+
" [http://pitecan.com/tmp/HelpLine.dmg HelpLine.dmg]をダウンロードし、`HelpLine.app`を`/Applications`フォルダに保存します",
|
49
|
+
" `/Applications/HelpLine.app` を右クリックで開いて認証して起動します",
|
50
|
+
" これは認証に必要なだけなので、すぐ終了してください",
|
51
|
+
" 以下の記述を`~/.zshrc`に追加します",
|
52
|
+
" Ctrl-Jを打つと`helpline`が起動します",
|
53
|
+
" code:.zshrc",
|
54
|
+
" function helpline() {",
|
55
|
+
" BUFFER=$(/Applications/HelpLine.app/Contents/MacOS/helpline \"${BUFFER}\")",
|
56
|
+
" CURSOR=${#BUFFER}",
|
57
|
+
" zle redisplay",
|
58
|
+
" }",
|
59
|
+
" zle -N helpline",
|
60
|
+
" bindkey \"^j\" helpline",
|
61
|
+
" [* 使い方]",
|
62
|
+
" `git`を使っているディレクトリで`zsh`で `git secr 履歴` などと入力した後でCtrl-Jを押すとHelpLineウィンドウが表示されます",
|
63
|
+
" フォルダに`secret.txt`がある場合です",
|
64
|
+
" [https://gyazo.com/cd7d52b02247d518f8910a0aec2d10f5]",
|
65
|
+
" 矢印キーなどで機能を選択してリターンを押すと、コマンドラインが置き換えられます",
|
66
|
+
"",
|
67
|
+
"",
|
68
|
+
"[** ソース]",
|
69
|
+
" https://github.com/masui/HelpLine",
|
70
|
+
"",
|
71
|
+
"[* データベース]",
|
72
|
+
" [/HelpLine]にあります",
|
73
|
+
"",
|
74
|
+
"[* 連絡先]",
|
75
|
+
" [/masui]",
|
76
|
+
""
|
77
|
+
]
|
78
|
+
},
|
79
|
+
{
|
80
|
+
"title": "このサイトについて",
|
81
|
+
"created": 1491961323,
|
82
|
+
"updated": 1520758821,
|
83
|
+
"id": "5efae8b50283f300246c8f52",
|
84
|
+
"lines": [
|
85
|
+
"このサイトについて",
|
86
|
+
" 複雑なシステムのドキュメントやマニュアルを書いているうちにヘルプシステムもできてしまうのを目指す",
|
87
|
+
" 複雑なシステムの例としてGitを使う",
|
88
|
+
" Gitの使い方を書くのと同時に、便利な`github`コマンドができる",
|
89
|
+
" [文芸的プログラミング]的",
|
90
|
+
" Gitの使い方をScrapboxに記述しつつ、[https://github.com/masui/GitHelp GitHelp]コマンドで使うためのデータも書いておく",
|
91
|
+
" 例えば[ファイルの編集回数のランキング]のページに 以下のようなデータを書いておくとgithelpコマンドで使える",
|
92
|
+
" `$ (よく|頻繁に)(編集|修正)されているファイルを(リスト|表示)する`",
|
93
|
+
" `% git log --name-only --pretty=\"format:\" | grep -ve \"^$\" | sort | uniq -c | sort -r`",
|
94
|
+
" 人間がわかる表現を正規表現で`$ xxx ...` と書く",
|
95
|
+
" その実行コマンドを`% git ...`と書く",
|
96
|
+
" ユーザが「頻繁」とか入力するとこの説明が出て、すぐ実行できる",
|
97
|
+
" `% githelp 頻繁`",
|
98
|
+
" 関数やマクロもScrapboxで定義する",
|
99
|
+
" コード記法で書いておく",
|
100
|
+
" [args] とか [Glossary] とか",
|
101
|
+
" 目標: [* UIST2018投稿]",
|
102
|
+
"",
|
103
|
+
"[https://scrapbox.io/projects/GitHelp/invitations/72392c14f9584cd15b7eb9c670547ed6 招待リンク]",
|
104
|
+
"",
|
105
|
+
""
|
106
|
+
]
|
107
|
+
},
|
108
|
+
{
|
109
|
+
"title": "ファイルの編集回数のランキング",
|
110
|
+
"created": 1492827356,
|
111
|
+
"updated": 1593833939,
|
112
|
+
"id": "5efae8b50283f300246c8f53",
|
113
|
+
"lines": [
|
114
|
+
"ファイルの編集回数のランキング",
|
115
|
+
"$ git: ファイルの#{change}のランキングを#{display}",
|
116
|
+
"$ git: (よく|頻繁に)#{change}(されてる|されている)ファイルを#{display}",
|
117
|
+
"$ git: ファイルの#{change}頻度を#{display}",
|
118
|
+
"$ git: ファイルを#{change}頻度順にソート",
|
119
|
+
"% git log --name-only --pretty=\"format:\" | grep -ve \"^$\" | sort | uniq -c | sort -r",
|
120
|
+
"",
|
121
|
+
"#ランキング #編集 #修正"
|
122
|
+
]
|
123
|
+
},
|
124
|
+
{
|
125
|
+
"title": "ファイル追加",
|
126
|
+
"created": 1495151660,
|
127
|
+
"updated": 1593834004,
|
128
|
+
"id": "5efae8b50283f300246c8f54",
|
129
|
+
"lines": [
|
130
|
+
"ファイル追加",
|
131
|
+
"$ git: 最初に「(#{params})」という文字列を含むコミットをした時から現在までに追加されたファイルはどれとどれ?",
|
132
|
+
"% git log --oneline --date=iso-strict --format='%cd %s' | grep #{$1} | tail -1 | awk '{print $1}' | xargs githelp-changed",
|
133
|
+
""
|
134
|
+
]
|
135
|
+
},
|
136
|
+
{
|
137
|
+
"title": "引数パラメタ",
|
138
|
+
"created": 1495152243,
|
139
|
+
"updated": 1593799894,
|
140
|
+
"id": "5efae8b50283f300246c8f55",
|
141
|
+
"lines": [
|
142
|
+
"引数パラメタ",
|
143
|
+
" 引数で与えられたパラメタ",
|
144
|
+
" githelp 'abc'",
|
145
|
+
" `'`, `\"` で囲む?",
|
146
|
+
" めんどくさい",
|
147
|
+
" `[`, `]`で囲む方がいいか?",
|
148
|
+
"",
|
149
|
+
"code:params.rb",
|
150
|
+
" def params(argv=ARGV)",
|
151
|
+
" File.open(\"/tmp/arg\",\"a\"){ |f|",
|
152
|
+
" f.puts argv",
|
153
|
+
" f.puts argv.class",
|
154
|
+
" }",
|
155
|
+
" if argv.class == String",
|
156
|
+
" argv = argv.split(/\\s/)",
|
157
|
+
" end",
|
158
|
+
" if argv.class == Array",
|
159
|
+
" argv = argv[0].split(/\\s/)",
|
160
|
+
" # argv.shift",
|
161
|
+
" end",
|
162
|
+
" File.open(\"/tmp/arg\",\"a\"){ |f|",
|
163
|
+
" f.puts argv.join(\"--\")",
|
164
|
+
" }",
|
165
|
+
" a = []",
|
166
|
+
" argv.each { |arg|",
|
167
|
+
" if arg =~ /^(\\d+)[^\\d]*$/ then",
|
168
|
+
" a << $1 ",
|
169
|
+
" elsif arg =~ /^'.*'$/ || arg =~ /^\".*\"$/ || arg =~ /^「.*」$/",
|
170
|
+
" a << arg.sub(/^['\"]/,'').sub(/['\"]$/,'').sub('「','').sub('」','')",
|
171
|
+
" elsif arg =~ /^\\[.*\\]$/",
|
172
|
+
" a << arg.sub(/^\\[/,'').sub(/\\]$/,'')",
|
173
|
+
" else",
|
174
|
+
" a << arg ",
|
175
|
+
" end",
|
176
|
+
" }",
|
177
|
+
" File.open(\"/tmp/arg\",\"a\"){ |f|",
|
178
|
+
" f.puts a.length > 0 ? a.join('|') : 'sample_param'",
|
179
|
+
" }",
|
180
|
+
" a.length > 0 ? a.join('|') : 'sample_param'",
|
181
|
+
" end",
|
182
|
+
"",
|
183
|
+
""
|
184
|
+
]
|
185
|
+
},
|
186
|
+
{
|
187
|
+
"title": "増井俊之",
|
188
|
+
"created": 1496475568,
|
189
|
+
"updated": 1496475568,
|
190
|
+
"id": "5efae8b50283f300246c8f56",
|
191
|
+
"lines": [
|
192
|
+
"増井俊之",
|
193
|
+
"[https://i.gyazo.com/ce44a0adde8a39df00cfa744d8f42d95.png]"
|
194
|
+
]
|
195
|
+
},
|
196
|
+
{
|
197
|
+
"title": "ファイル復元",
|
198
|
+
"created": 1496645946,
|
199
|
+
"updated": 1593830771,
|
200
|
+
"id": "5efae8b50283f300246c8f57",
|
201
|
+
"lines": [
|
202
|
+
"ファイル復元",
|
203
|
+
"$ git: (1つ|ひとつ)前のコミットで#{deleted}#{gitfiles}を(復元する|元に戻す)",
|
204
|
+
"% git checkout $(git rev-list -n 1 HEAD -- #{3})^ -- #{$3}",
|
205
|
+
"",
|
206
|
+
" `--` の後にファイル名を書ける (getoptの仕様らしい)",
|
207
|
+
" `$(...)` は `\\`xxx`` と同じ (bashの記法)",
|
208
|
+
""
|
209
|
+
]
|
210
|
+
},
|
211
|
+
{
|
212
|
+
"title": "ユーザ情報",
|
213
|
+
"created": 1496646067,
|
214
|
+
"updated": 1593834531,
|
215
|
+
"id": "5efae8b50283f300246c8f58",
|
216
|
+
"lines": [
|
217
|
+
"ユーザ情報",
|
218
|
+
"code:users.rb",
|
219
|
+
" def users",
|
220
|
+
" list = begin",
|
221
|
+
" `git shortlog -sn 2> /dev/null`",
|
222
|
+
" rescue",
|
223
|
+
" []",
|
224
|
+
" end",
|
225
|
+
" list.split(/\\n/).collect { |s|",
|
226
|
+
" s.sub(/^\\s*\\d*\\s*/,'')",
|
227
|
+
" }.join(\"|\")",
|
228
|
+
" end",
|
229
|
+
"",
|
230
|
+
"$ git: (ユーザ|コミッタ)をリストする",
|
231
|
+
"% git shortlog -sn | ruby -p -e 'gsub(/^\\\\s*\\\\d*\\\\s*/,\"\")'",
|
232
|
+
"",
|
233
|
+
"$ git: (コミッタ|ユーザ)のランキングを表示する",
|
234
|
+
"$ git: コミッタをリストする",
|
235
|
+
"% git shortlog -sn",
|
236
|
+
"",
|
237
|
+
"$ git: ユーザ「(#{users})」による(#{numbers})週間の変更を(リスト|表示)する",
|
238
|
+
"% git log --author='#{$1}' --since=#{$2}.week",
|
239
|
+
"",
|
240
|
+
"$ git: (コミッタ|ユーザ)「(#{users})」のこれまでの変更した行数を(リスト|表示)する",
|
241
|
+
"% git log --author='#{$2}' --pretty=tformat: --numstat | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf \"added lines: %s, removed lines: %s, total lines: %s\\\\n\", add, subs, loc }'",
|
242
|
+
""
|
243
|
+
]
|
244
|
+
},
|
245
|
+
{
|
246
|
+
"title": "文字列の出現判定",
|
247
|
+
"created": 1496889295,
|
248
|
+
"updated": 1593834601,
|
249
|
+
"id": "5efae8b50283f300246c8f59",
|
250
|
+
"lines": [
|
251
|
+
"文字列の出現判定",
|
252
|
+
"$ git: (#{gitfiles})に(#{params})という名前が(出現した|書かれた)のはいつ?",
|
253
|
+
"% git blame #{$1} | grep #{$2}",
|
254
|
+
""
|
255
|
+
]
|
256
|
+
},
|
257
|
+
{
|
258
|
+
"title": "gitのブランチ",
|
259
|
+
"created": 1496889490,
|
260
|
+
"updated": 1593822252,
|
261
|
+
"id": "5efae8b50283f300246c8f5a",
|
262
|
+
"lines": [
|
263
|
+
"gitのブランチ",
|
264
|
+
"$ git: ブランチを#{display}",
|
265
|
+
"% git branch",
|
266
|
+
"",
|
267
|
+
"$ git: 「(#{params})」というブランチを作成する",
|
268
|
+
"% git branch #{$1}",
|
269
|
+
"",
|
270
|
+
"$ git: 「(#{params})」というブランチを#{delete}",
|
271
|
+
"% git branch -d #{$1}",
|
272
|
+
"",
|
273
|
+
"#ブランチ",
|
274
|
+
"",
|
275
|
+
""
|
276
|
+
]
|
277
|
+
},
|
278
|
+
{
|
279
|
+
"title": "gitの古いファイル表示",
|
280
|
+
"created": 1496889662,
|
281
|
+
"updated": 1593829527,
|
282
|
+
"id": "5efae8b50283f300246c8f5b",
|
283
|
+
"lines": [
|
284
|
+
"gitの古いファイル表示",
|
285
|
+
"$ git: ひとつ前の「(#{gitfiles})」ファイルを(#{display})",
|
286
|
+
"$ git: 1バージョン前の「(#{gitfiles})」ファイルを(#{display})",
|
287
|
+
"% git show HEAD~:#{$1}",
|
288
|
+
"",
|
289
|
+
"$ git: ふたつ前の「(#{gitfiles})」ファイルを(#{display})",
|
290
|
+
"$ git: 2バージョン前の「(#{gitfiles})」ファイルを(#{display})",
|
291
|
+
"% git show HEAD~~:#{$1}",
|
292
|
+
"",
|
293
|
+
"$ git: (#{numbers})個前の「(#{gitfiles})」ファイルを(#{display})",
|
294
|
+
"$ git: (#{numbers})バージョン前の「(#{gitfiles})」ファイルを(#{display})",
|
295
|
+
"% git show HEAD~#{$1}:#{$2}",
|
296
|
+
"",
|
297
|
+
"$ git: (#{numbers})分前の「(#{gitfiles})」ファイルを(#{display})",
|
298
|
+
"% git show '@{#{$1} minutes ago}':#{$2}",
|
299
|
+
"# % git cat-file -p '@{#{$1} minutes ago}':#{$2}",
|
300
|
+
"",
|
301
|
+
"$ git: (#{numbers})時間前の「(#{gitfiles})」ファイルを(#{display})",
|
302
|
+
"% git show '@{#{$1} hours ago}':#{$2}",
|
303
|
+
"",
|
304
|
+
"$ git: (#{numbers})日前の「(#{gitfiles})」ファイルを(#{display})",
|
305
|
+
"% git show '@{#{$1} days ago}':#{$2}",
|
306
|
+
"",
|
307
|
+
"$ git: 昨日の「(#{gitfiles})」ファイルを(#{display})",
|
308
|
+
"% git show @{yesterday}:#{$1}",
|
309
|
+
"",
|
310
|
+
"# $ 「(#{tags})」というタグがついているファイル「(#{gitfiles})」を(#{display})",
|
311
|
+
"# % git show #{$1} #{$2}",
|
312
|
+
"",
|
313
|
+
"#表示",
|
314
|
+
""
|
315
|
+
]
|
316
|
+
},
|
317
|
+
{
|
318
|
+
"title": "文字列の出現を調べる",
|
319
|
+
"created": 1497321083,
|
320
|
+
"updated": 1593834639,
|
321
|
+
"id": "5efae8b50283f300246c8f5c",
|
322
|
+
"lines": [
|
323
|
+
"文字列の出現を調べる",
|
324
|
+
"$ git: (#{gitfiles})に(#{params})という名前が(出現した|書かれた)のはいつ?",
|
325
|
+
"% git blame #{$1} | grep #{$2}",
|
326
|
+
"",
|
327
|
+
"$ git: (#{params})という名前が(#{gitfiles})に(出現した|書かれた)のはいつ?",
|
328
|
+
"% git blame #{$2} | grep #{$1}",
|
329
|
+
"",
|
330
|
+
"fileがわからないときはどうするのか?",
|
331
|
+
""
|
332
|
+
]
|
333
|
+
},
|
334
|
+
{
|
335
|
+
"title": "gitのブランチの表示",
|
336
|
+
"created": 1497321104,
|
337
|
+
"updated": 1593832190,
|
338
|
+
"id": "5efae8b50283f300246c8f5d",
|
339
|
+
"lines": [
|
340
|
+
"gitのブランチの表示",
|
341
|
+
"$ git: ブランチ(のリスト)?を#{display}",
|
342
|
+
"% git branch",
|
343
|
+
"",
|
344
|
+
"$ git: #{params}というブランチを作成する",
|
345
|
+
"% git branch #{$1}",
|
346
|
+
"",
|
347
|
+
"$ git: #{branches}というブランチを#{delete}",
|
348
|
+
"% git branch -d #{$1}",
|
349
|
+
""
|
350
|
+
]
|
351
|
+
},
|
352
|
+
{
|
353
|
+
"title": "関連文献",
|
354
|
+
"created": 1520295677,
|
355
|
+
"updated": 1593377622,
|
356
|
+
"id": "5efae8b50283f300246c8f5e",
|
357
|
+
"lines": [
|
358
|
+
"関連文献",
|
359
|
+
" [/UIPedia/Greg Little: Translating keyword commands into executable code]",
|
360
|
+
" Rob Miller, 2008",
|
361
|
+
" 「[[left margin 4 inches]]」と言うと「[[ActiveDocument.PageSetup.LeftMargin=InchesToPoints(2) ]]」を実行できる",
|
362
|
+
" ほとんど同じかもしれない?",
|
363
|
+
" 汎用性は無いんじゃないかな",
|
364
|
+
" [/UIPedia/Tihomir Gvero: Synthesizing Java expressions from free-form queries]",
|
365
|
+
" anyCodeというシステム。自然言語キーワードを入力するとコードスニペットが表示される。",
|
366
|
+
" [[copy fileA fileB]]みたいなキーワードから[[FileUtil.copyFile(new File(fileA), new File(fileB))]]みたいなコード候補を生成する",
|
367
|
+
" [自然言語処理]を行なっている",
|
368
|
+
" [/UIPedia/Björn Hartmann: What would other programmers do: suggesting solutions to error messages]",
|
369
|
+
" 他人のヒストリを使ってコンパイルエラー対処法をサジェスト",
|
370
|
+
" [/UIPedia/George Furnas: The vocabulary problem in human-system communication]",
|
371
|
+
" なかなか正しい言葉を使えないという古い論文",
|
372
|
+
" 「語彙問題」",
|
373
|
+
"",
|
374
|
+
"#★",
|
375
|
+
""
|
376
|
+
]
|
377
|
+
},
|
378
|
+
{
|
379
|
+
"title": "gitレポジトリを確認する",
|
380
|
+
"created": 1593374428,
|
381
|
+
"updated": 1593834347,
|
382
|
+
"id": "5efae8b50283f300246c8f5f",
|
383
|
+
"lines": [
|
384
|
+
"gitレポジトリを確認する",
|
385
|
+
"$ git: レポジトリの中身を(確認する|見る|調べる)",
|
386
|
+
"% ls .git",
|
387
|
+
"この例では`git`コマンドが使われていないが... [Issues]",
|
388
|
+
"",
|
389
|
+
"$ git: リモートレポジトリを確認する",
|
390
|
+
"% git remote -v",
|
391
|
+
"",
|
392
|
+
"#レポジトリ",
|
393
|
+
""
|
394
|
+
]
|
395
|
+
},
|
396
|
+
{
|
397
|
+
"title": "Issues",
|
398
|
+
"created": 1593375238,
|
399
|
+
"updated": 1593822041,
|
400
|
+
"id": "5efae8b50283f300246c8f60",
|
401
|
+
"lines": [
|
402
|
+
"Issues",
|
403
|
+
"[[Gem版]]",
|
404
|
+
" git専用のヘルプのような制約を書きたい",
|
405
|
+
" `.git`が存在し、キーワードが`git`を含むときだけ出すとか",
|
406
|
+
" `$ git: ファイルを大きい順に表示` などと書けばよいだろうか?",
|
407
|
+
" 様々なコマンドへの対応",
|
408
|
+
" 登録を簡単にする工夫",
|
409
|
+
"",
|
410
|
+
"[[Electron版]]",
|
411
|
+
" paramsが動いていない",
|
412
|
+
" 日本語入力すると固まる",
|
413
|
+
" Peco方式の方が楽かもしれない...",
|
414
|
+
" こちらはRubyで実装したもの",
|
415
|
+
" なんでElectronにしたんだっけ?",
|
416
|
+
" IMEみたいにしたかったからだっけ?",
|
417
|
+
" Ruby版(CLI版)も復活させるか?",
|
418
|
+
" 関数の返り値には`(` ... `)` をつけたい",
|
419
|
+
" クリックしたらすぐ反映させる",
|
420
|
+
" リターン押さなくても良いように",
|
421
|
+
" 論文にするための工夫 [★]",
|
422
|
+
" Rob Millerなどに聞くとか",
|
423
|
+
" いろんな人に利用させてDB追加していく経緯を論文に書く",
|
424
|
+
" いろんなコマンドに対応する方法",
|
425
|
+
" データベースを分けるのか?",
|
426
|
+
" `% git` みたいな記述をもとにする?",
|
427
|
+
" `$ git: ...` みたいに記述するとか",
|
428
|
+
" うまくいった例を[やりたいことの例]に記述しておく",
|
429
|
+
""
|
430
|
+
]
|
431
|
+
},
|
432
|
+
{
|
433
|
+
"title": "★",
|
434
|
+
"created": 1593377448,
|
435
|
+
"updated": 1593377452,
|
436
|
+
"id": "5efae8b50283f300246c8f62",
|
437
|
+
"lines": [
|
438
|
+
"★",
|
439
|
+
"論文ポイント",
|
440
|
+
""
|
441
|
+
]
|
442
|
+
},
|
443
|
+
{
|
444
|
+
"title": "やりたいことの例",
|
445
|
+
"created": 1519557995,
|
446
|
+
"updated": 1593389998,
|
447
|
+
"id": "5efae8b50283f300246c8f65",
|
448
|
+
"lines": [
|
449
|
+
"やりたいことの例",
|
450
|
+
" うっかりパスワードを書いてしまったファイルを過去コミットから削除する",
|
451
|
+
" [しばらく変化ないファイルをリストする]",
|
452
|
+
" ふたつ前のバージョンと比較する",
|
453
|
+
" 昨日の夜から変えたところを表示する",
|
454
|
+
" [最近編集したファイルのリストを表示する]",
|
455
|
+
" reset",
|
456
|
+
" revert",
|
457
|
+
" rebase",
|
458
|
+
"",
|
459
|
+
"うまくいった例",
|
460
|
+
"> 1時間前から修正したファイルをリストする",
|
461
|
+
"> secret.txtに関する編集履歴を完全に消す",
|
462
|
+
"",
|
463
|
+
"> abcという文字列がはじめて出現したバージョンの情報を表示する",
|
464
|
+
""
|
465
|
+
]
|
466
|
+
},
|
467
|
+
{
|
468
|
+
"title": "特定のファイルの履歴を消す",
|
469
|
+
"created": 1519563847,
|
470
|
+
"updated": 1593834578,
|
471
|
+
"id": "5efae8b50283f300246c8f66",
|
472
|
+
"lines": [
|
473
|
+
"特定のファイルの履歴を消す",
|
474
|
+
" パスワードを直書きしたファイルを間違ってアップロードしたときなど、どうする?",
|
475
|
+
" パスワードを含むファイルを捜す",
|
476
|
+
" git grep する",
|
477
|
+
" [変数や単語が出現しているファイルを捜す]",
|
478
|
+
" そのファイルを完全に履歴から消去する",
|
479
|
+
" という処理が必要だが、かなり難しいはず",
|
480
|
+
" こういうのをGitHelpできると嬉しいんじゃないだろうか",
|
481
|
+
" そういう解説があった",
|
482
|
+
" [https://help.github.com/articles/removing-sensitive-data-from-a-repository/ Removing sensitive data from a repository - User Documentation]",
|
483
|
+
" https://git-scm.com/book/ja/v1/Git-のさまざまなツール-歴史の書き換え",
|
484
|
+
"",
|
485
|
+
"xxxxxx.txtの履歴を消す",
|
486
|
+
" http://d.hatena.ne.jp/ichhi/20110825/1314300975",
|
487
|
+
"$ git: ファイル「(#{gitfiles})」の編集履歴を完全に(#{delete})がワーキングツリーは残す",
|
488
|
+
"% git filter-branch -f --index-filter 'git rm --cached --ignore-unmatch #{$1}' HEAD",
|
489
|
+
"",
|
490
|
+
"GitHub の commit 履歴からパスワードファイル等だけを消す方法",
|
491
|
+
" https://qiita.com/MahoTakara/items/3b02bf55767a6372596e",
|
492
|
+
"$ git: ファイル「(#{gitfiles})」の編集履歴を完全に(#{delete})",
|
493
|
+
"% git filter-branch -f --index-filter 'git rm --ignore-unmatch #{$1}' HEAD",
|
494
|
+
"",
|
495
|
+
"どういう意味なのやら?",
|
496
|
+
" filter-branch というのは、大量コマンドを一気に実行するものらしい",
|
497
|
+
" 全部やるもの",
|
498
|
+
" --tree-filter チェックアウトしてコマンド実行",
|
499
|
+
" --index-filter インデックスに対してコマンド実行",
|
500
|
+
" git rm",
|
501
|
+
" --ignore-umatch",
|
502
|
+
" マッチしなくても続行する",
|
503
|
+
"",
|
504
|
+
"GitHubの方に反映させる",
|
505
|
+
"$ git: 編集履歴をGitHubに反映させる",
|
506
|
+
"% git push origin --force --all",
|
507
|
+
""
|
508
|
+
]
|
509
|
+
},
|
510
|
+
{
|
511
|
+
"title": "変数や単語が出現しているファイルを捜す",
|
512
|
+
"created": 1519691492,
|
513
|
+
"updated": 1593834446,
|
514
|
+
"id": "5efae8b50283f300246c8f67",
|
515
|
+
"lines": [
|
516
|
+
"変数や単語が出現しているファイルを捜す",
|
517
|
+
" 普通にgrep = git grep",
|
518
|
+
" 間違ってパスワードなどをコミットしてないかチェックするとか",
|
519
|
+
" [https://qiita.com/zwirky/items/19df2d8d3d584da2790b 個人的によく使うgit grepのまとめ - Qiita]",
|
520
|
+
"",
|
521
|
+
"$ git: 「(#{params})」という文字列を含むファイルを捜す",
|
522
|
+
"% git grep '#{$1}'",
|
523
|
+
"",
|
524
|
+
"$ git: 「(#{params})」という文字列を含むファイルを全履歴から捜す",
|
525
|
+
"% git rev-list --all | xargs git grep '#{$1}'",
|
526
|
+
"",
|
527
|
+
"関連: [文字列がはじめて出現したバージョンを捜す]",
|
528
|
+
""
|
529
|
+
]
|
530
|
+
},
|
531
|
+
{
|
532
|
+
"title": "ツリー状にログを表示する",
|
533
|
+
"created": 1519698152,
|
534
|
+
"updated": 1593834013,
|
535
|
+
"id": "5efae8b50283f300246c8f68",
|
536
|
+
"lines": [
|
537
|
+
"ツリー状にログを表示する",
|
538
|
+
"$ git: ツリー状にログを表示する",
|
539
|
+
"% git log --graph --all --format=\"%x09%an%x09%h %d %s\"",
|
540
|
+
""
|
541
|
+
]
|
542
|
+
},
|
543
|
+
{
|
544
|
+
"title": "ファイル名変更",
|
545
|
+
"created": 1519809729,
|
546
|
+
"updated": 1593831265,
|
547
|
+
"id": "5efae8b50283f300246c8f69",
|
548
|
+
"lines": [
|
549
|
+
"ファイル名変更",
|
550
|
+
"$ git: 「#{gitfiles}」というファイルを「#{params}」という名前に(変更|移動|改名|リネーム)する",
|
551
|
+
"% git mv #{$1} #{$2}",
|
552
|
+
""
|
553
|
+
]
|
554
|
+
},
|
555
|
+
{
|
556
|
+
"title": "追加/削除された行数",
|
557
|
+
"created": 1519809816,
|
558
|
+
"updated": 1593834390,
|
559
|
+
"id": "5efae8b50283f300246c8f6a",
|
560
|
+
"lines": [
|
561
|
+
"追加/削除された行数",
|
562
|
+
"$ git: これまで追加/削除された行数を表示する",
|
563
|
+
"% git log --numstat --pretty=\"%H\" | awk 'NF==3 {plus+=$1; minus+=$2} END {printf(\"+%d, -%d\\\\n\", plus, minus)}'",
|
564
|
+
""
|
565
|
+
]
|
566
|
+
},
|
567
|
+
{
|
568
|
+
"title": "gitの古いファイルとの比較",
|
569
|
+
"created": 1519817302,
|
570
|
+
"updated": 1593834701,
|
571
|
+
"id": "5efae8b50283f300246c8f6b",
|
572
|
+
"lines": [
|
573
|
+
"gitの古いファイルとの比較",
|
574
|
+
" 古いファイルとの比較は`git diff`コマンドを利用する",
|
575
|
+
" `$ git diff ファイル名`とすると、現在[編集中のファイル]と最新[コミット]との違いが表示される",
|
576
|
+
" 以前コミットされたものと比較したい場合、[コミットID]を指定してバージョン間の比較ができる",
|
577
|
+
" [コミットID]を使わなくてもいろんな[バージョン指定]方法が可能だが指定方法は結構難しい",
|
578
|
+
"",
|
579
|
+
"[* 時間を指定して比較]",
|
580
|
+
"",
|
581
|
+
" `@{2 days ago}`のような表記で時間を指定できる",
|
582
|
+
"",
|
583
|
+
"[* 例 (Examples)]",
|
584
|
+
"> $ Compare file xxxx with the one from 2 days ago",
|
585
|
+
"> $ xxxxというファイルを2日前のものと比較する",
|
586
|
+
"> $ 2日前のxxxxというファイルを現在のものと比較する",
|
587
|
+
"> % git diff HEAD '@{2 days ago}' xxxx",
|
588
|
+
"",
|
589
|
+
"$ git: 「(#{gitfiles})」ファイルを(#{numbers})分前の(もの|バージョン)と#{compare}",
|
590
|
+
"$ git: 「(#{gitfiles})」ファイルが(#{numbers})分前から(変化した|変わった)ところを(#{display})",
|
591
|
+
"% git diff HEAD '@{#{$2} minutes ago}' #{$1}",
|
592
|
+
"",
|
593
|
+
"$ git: (#{numbers})分前の「(#{gitfiles})」ファイルと現在の(もの|バージョン)を#{compare}",
|
594
|
+
"% git diff HEAD '@{#{$1} minutes ago}' #{$2}",
|
595
|
+
"",
|
596
|
+
"$ git: (#{numbers})日前の「(#{gitfiles})」ファイルと現在のものを#{compare}",
|
597
|
+
"% git diff HEAD '@{#{$1} days ago}' #{$2}",
|
598
|
+
"",
|
599
|
+
"$ git: 現在の「(#{gitfiles})」ファイルを(#{numbers})日前のものを#{compare}",
|
600
|
+
"% git diff HEAD '@{#{$2} days ago}' #{$1}",
|
601
|
+
"",
|
602
|
+
"[* 昔のバージョンとの比較]",
|
603
|
+
"",
|
604
|
+
" 内容が変化したもののリストは`rev-list`で取得できる",
|
605
|
+
" コミットが古くても内容が変わってないことはある",
|
606
|
+
" code:sample.sh",
|
607
|
+
" $ git rev-list HEAD -- file1.txt",
|
608
|
+
" 2630b29f9d687c6ff94e4ccee77efd9720e3fa7a",
|
609
|
+
" 084b9e1d603b20967df24c126f4446cb30984346",
|
610
|
+
" 73461054520e49b5f20266a27f4927d909eb9e3c",
|
611
|
+
" $ ",
|
612
|
+
" `git log file1.txt` で出るのと同じだがIDだけリストされる",
|
613
|
+
" 2行目のコミットIDがふたつ前のバージョン",
|
614
|
+
" 普通は`git log`でリストされた[コミットID]を指定して`git diff`するのかもしれない",
|
615
|
+
" `git --patch -1` という方法もあるらしい",
|
616
|
+
" `patch`は微妙に`diff`じゃないかもしれないけど",
|
617
|
+
"",
|
618
|
+
"$ git: (1つ|ひとつ)前のバージョンの(#{gitfiles})と#{compare}",
|
619
|
+
"$ git: (1つ|ひとつ)前のバージョンの(#{gitfiles})からの変更点",
|
620
|
+
"% git diff $(git rev-list -n 1 HEAD -- #{$2})^ -- #{$2}",
|
621
|
+
"",
|
622
|
+
"$ git: (#{gitfiles})を(1つ|ひとつ)前のバージョンと#{compare}",
|
623
|
+
"$ git: (#{gitfiles})の(1つ|ひとつ)前のバージョンからの変更点",
|
624
|
+
"% git diff $(git rev-list -n 1 HEAD -- #{$1})^ -- #{$1}",
|
625
|
+
"",
|
626
|
+
"$ git: (#{gitfiles})の最新版の変更点を(#{display})",
|
627
|
+
"$ git: 最新の(#{gitfiles})の#{change}個所は?",
|
628
|
+
"$ git: (#{gitfiles})は最後にどこを変えた?",
|
629
|
+
"$ git: (#{gitfiles})の(一番新しい|最新の)#{change}は?",
|
630
|
+
"% git diff $(git rev-list -n 1 HEAD -- #{$1})^ -- #{$1}",
|
631
|
+
"",
|
632
|
+
"$ git: (2つ|ふたつ)前のバージョンの(#{gitfiles})と#{compare}",
|
633
|
+
"$ git: (2つ|ふたつ)前のバージョンの(#{gitfiles})からの変更点を(#{display})",
|
634
|
+
"% git diff $(git rev-list -n 2 HEAD -- #{$2})^^ -- #{$2}",
|
635
|
+
"",
|
636
|
+
"$ git: (#{gitfiles})を(2つ|ふたつ)前のバージョンと#{compare}",
|
637
|
+
"$ git: (#{gitfiles})の(2つ|ふたつ)前のバージョンのからの#{change}を(#{display})",
|
638
|
+
"% git diff $(git rev-list -n 2 HEAD -- #{$1})^^ -- #{$1}",
|
639
|
+
""
|
640
|
+
]
|
641
|
+
},
|
642
|
+
{
|
643
|
+
"title": "数字パラメタ",
|
644
|
+
"created": 1519905222,
|
645
|
+
"updated": 1520230812,
|
646
|
+
"id": "5efae8b50283f300246c8f6c",
|
647
|
+
"lines": [
|
648
|
+
"数字パラメタ",
|
649
|
+
"code:numbers.rb",
|
650
|
+
" def numbers(argv=ARGV)",
|
651
|
+
" a = []",
|
652
|
+
" argv.each { |arg|",
|
653
|
+
" if arg =~ /^(\\d+)[^\\d]*$/ then",
|
654
|
+
" a << $1",
|
655
|
+
" end",
|
656
|
+
" }",
|
657
|
+
" # a.join(\"|\") ",
|
658
|
+
" a.length > 0 ? a.join(\"|\") : '1'",
|
659
|
+
" end",
|
660
|
+
" "
|
661
|
+
]
|
662
|
+
},
|
663
|
+
{
|
664
|
+
"title": "gitファイルリスト",
|
665
|
+
"created": 1520137762,
|
666
|
+
"updated": 1593836866,
|
667
|
+
"id": "5efae8b60283f300246c8f6d",
|
668
|
+
"lines": [
|
669
|
+
"gitファイルリスト",
|
670
|
+
"引数の中にファイル名とマッチするものがあればファイルリストを取得 ",
|
671
|
+
"",
|
672
|
+
"code:files.rb",
|
673
|
+
" def gitfiles(argv=ARGV)",
|
674
|
+
" list = begin",
|
675
|
+
" files = `git ls-files 2> /dev/null`.split(/\\n/)",
|
676
|
+
" rescue",
|
677
|
+
" files = []",
|
678
|
+
" end",
|
679
|
+
" matched = {}",
|
680
|
+
" list.each { |file|",
|
681
|
+
" if argv.length == 0",
|
682
|
+
" matched[file] = true",
|
683
|
+
" else",
|
684
|
+
" # args(argv).each { |arg|",
|
685
|
+
" argv[0].split(/\\s/).each { |arg|",
|
686
|
+
" matched[file] = true if /#{arg}/i =~ file",
|
687
|
+
" }",
|
688
|
+
" end",
|
689
|
+
" }",
|
690
|
+
" files = matched.keys",
|
691
|
+
" files = [\"voidvoidvoid\"] if files.length == 0",
|
692
|
+
" \"(\" + files.join(\"|\") + \")\"",
|
693
|
+
" end",
|
694
|
+
"",
|
695
|
+
"[引数パラメタ]",
|
696
|
+
""
|
697
|
+
]
|
698
|
+
},
|
699
|
+
{
|
700
|
+
"title": "args",
|
701
|
+
"created": 1520160117,
|
702
|
+
"updated": 1520199968,
|
703
|
+
"id": "5efae8b60283f300246c8f6e",
|
704
|
+
"lines": [
|
705
|
+
"args",
|
706
|
+
"code:args.rb",
|
707
|
+
" def args(argv=ARGV)",
|
708
|
+
" a = []",
|
709
|
+
" argv.each { |arg|",
|
710
|
+
" if arg =~ /^(\\d+)([^\\d]+)?$/ then",
|
711
|
+
" a << $1",
|
712
|
+
" a << $2 if $2.to_s != ''",
|
713
|
+
" else",
|
714
|
+
" a << arg.sub(/^['\"]/,'').sub(/['\"]$/,'').sub('「','').sub('」','')",
|
715
|
+
" end",
|
716
|
+
" }",
|
717
|
+
" a.length > 0 ? a : ['']",
|
718
|
+
" end",
|
719
|
+
""
|
720
|
+
]
|
721
|
+
},
|
722
|
+
{
|
723
|
+
"title": "gitのファイル削除",
|
724
|
+
"created": 1520212560,
|
725
|
+
"updated": 1593828447,
|
726
|
+
"id": "5efae8b60283f300246c8f6f",
|
727
|
+
"lines": [
|
728
|
+
"gitのファイル削除",
|
729
|
+
"$ git: ファイル「#{gitfiles}」を#{delete}",
|
730
|
+
"% git rm #{$1}",
|
731
|
+
"",
|
732
|
+
"#削除",
|
733
|
+
""
|
734
|
+
]
|
735
|
+
},
|
736
|
+
{
|
737
|
+
"title": "コメント修正",
|
738
|
+
"created": 1520231491,
|
739
|
+
"updated": 1593834413,
|
740
|
+
"id": "5efae8b60283f300246c8f70",
|
741
|
+
"lines": [
|
742
|
+
"コメント修正",
|
743
|
+
"$ git: 直前のコミットのコメントを修正する",
|
744
|
+
"% git commit --amend",
|
745
|
+
""
|
746
|
+
]
|
747
|
+
},
|
748
|
+
{
|
749
|
+
"title": "Git情報源",
|
750
|
+
"created": 1520232064,
|
751
|
+
"updated": 1593377647,
|
752
|
+
"id": "5efae8b60283f300246c8f71",
|
753
|
+
"lines": [
|
754
|
+
"Git情報源",
|
755
|
+
" [https://backlog.com/ja/git-tutorial/reference/ 逆引きGit]",
|
756
|
+
" [Gitでやらかした時に使える19個の奥義 https://qiita.com/muran001/items/dea2bbbaea1260098051]",
|
757
|
+
" [https://github.com/blog/2019-how-to-undo-almost-anything-with-git Gitの様々なundo]",
|
758
|
+
" [https://qiita.com/zwirky/items/19df2d8d3d584da2790b 個人的によく使うgit grepのまとめ - Qiita]",
|
759
|
+
" [https://www.kernel.org/pub/software/scm/git/docs/gitrevisions.html gitrevisions]",
|
760
|
+
" manより読みやすい",
|
761
|
+
" e.g. https://www.kernel.org/pub/software/scm/git/docs/git-rev-parse.html",
|
762
|
+
""
|
763
|
+
]
|
764
|
+
},
|
765
|
+
{
|
766
|
+
"title": "新しい順にファイルを表示",
|
767
|
+
"created": 1520241167,
|
768
|
+
"updated": 1593833496,
|
769
|
+
"id": "5efae8b60283f300246c8f73",
|
770
|
+
"lines": [
|
771
|
+
"新しい順にファイルを表示",
|
772
|
+
"$ git: ファイルを新しい順に(リスト|表示)する",
|
773
|
+
"$ git: ファイルを新しさ順に(リスト|表示)する",
|
774
|
+
"$ git: 新しいファイルから順番に(リスト|表示)する",
|
775
|
+
"% git ls-files | xargs ls -l -t",
|
776
|
+
""
|
777
|
+
]
|
778
|
+
},
|
779
|
+
{
|
780
|
+
"title": "タグ",
|
781
|
+
"created": 1520242919,
|
782
|
+
"updated": 1593834926,
|
783
|
+
"id": "5efae8b60283f300246c8f74",
|
784
|
+
"lines": [
|
785
|
+
"タグ",
|
786
|
+
"code:tags.rb",
|
787
|
+
" def tags",
|
788
|
+
" tags = begin",
|
789
|
+
" `git tag 2> /dev/null`.split(/\\n/)",
|
790
|
+
" rescue",
|
791
|
+
" end",
|
792
|
+
" tags = [\"no_tag\"] if tags.length == 0",
|
793
|
+
" tags.join(\"|\")",
|
794
|
+
" end",
|
795
|
+
"",
|
796
|
+
"$ git: 現在使われているタグを(リスト|表示)する",
|
797
|
+
"% git tag",
|
798
|
+
"",
|
799
|
+
"$ git: 現在のコミットに「(#{params})」というタグを関連付けする",
|
800
|
+
"$ git: 「(#{params})」というタグを現在のコミットIDに関連付けする",
|
801
|
+
"% git tag '#{$1}'",
|
802
|
+
"",
|
803
|
+
"$ git: 「(#{tags})」というタグを(#{delete})",
|
804
|
+
"% git tag -d '#{$1}'",
|
805
|
+
"",
|
806
|
+
"$ git: 「(#{tags})」というタグのファイル「(#{gitfiles})」を(#{display})",
|
807
|
+
"% git show '#{$1}' #{$2}",
|
808
|
+
"",
|
809
|
+
"$ git: ファイル「(#{gitfiles})」で「(#{tags})」というタグがついてるものを(#{display})",
|
810
|
+
"% git show '#{$2}' #{$1}",
|
811
|
+
""
|
812
|
+
]
|
813
|
+
},
|
814
|
+
{
|
815
|
+
"title": "ブランチ名",
|
816
|
+
"created": 1520288193,
|
817
|
+
"updated": 1593833581,
|
818
|
+
"id": "5efae8b60283f300246c8f77",
|
819
|
+
"lines": [
|
820
|
+
"ブランチ名",
|
821
|
+
"$ git: ブランチ名を(#{params})に変える",
|
822
|
+
"% git branch -m #{$1}",
|
823
|
+
"",
|
824
|
+
"#ブランチ",
|
825
|
+
""
|
826
|
+
]
|
827
|
+
},
|
828
|
+
{
|
829
|
+
"title": "コミットをまとめる",
|
830
|
+
"created": 1520289005,
|
831
|
+
"updated": 1593834375,
|
832
|
+
"id": "5efae8b60283f300246c8f78",
|
833
|
+
"lines": [
|
834
|
+
"コミットをまとめる",
|
835
|
+
"$ git: (#{numbers})個前までのコミットをまとめる",
|
836
|
+
"% git rebase -i HEAD~#{$1}",
|
837
|
+
"",
|
838
|
+
"#コミット",
|
839
|
+
""
|
840
|
+
]
|
841
|
+
},
|
842
|
+
{
|
843
|
+
"title": "意義",
|
844
|
+
"created": 1520289678,
|
845
|
+
"updated": 1593559281,
|
846
|
+
"id": "5efae8b60283f300246c8f79",
|
847
|
+
"lines": [
|
848
|
+
"意義",
|
849
|
+
" 人間が本当にやりたいこととその実行手段の乖離をなんとかする",
|
850
|
+
" gitのコマンドは激しく複雑なのでなんとかしたい",
|
851
|
+
"",
|
852
|
+
"[* Contribution]",
|
853
|
+
" 現在のコンテクストに依存してヘルプを出せること",
|
854
|
+
" そういうヘルプシステムは沢山あるだろうけど",
|
855
|
+
" パラメタを指定してすぐ実行できること",
|
856
|
+
" `2` のような具体的な数字や `file`のようなファイル名などを直接指定",
|
857
|
+
" 曖昧検索できること",
|
858
|
+
" できたっけ?",
|
859
|
+
" できてない",
|
860
|
+
" できるようにしよう",
|
861
|
+
" 正規表現を展開するので誰でも簡単に情報を追加していける",
|
862
|
+
" 素人でも対応しやすい",
|
863
|
+
" みんなで更新できる [★]",
|
864
|
+
" Wikiなので普通に文書として便利なはず",
|
865
|
+
" [* 解説ページがそのままヘルプデータベースになってるみたいな]",
|
866
|
+
" ここを主張すると論文的にウケが良いかもしれない",
|
867
|
+
" 普通に逆引きドキュメントを書いてるとヘルプシステムになってしまう",
|
868
|
+
" [* 普通はヘルプシステムと解説ドキュメントは別なので]",
|
869
|
+
" これができるシステムはあまり無いだろう",
|
870
|
+
" [gitの古いファイルとの比較] では、`git diff`の解説と[* 実例]を書いているのでわかりやすいハズ",
|
871
|
+
" 解説と具体的利用法を並べるのは筋が通っている",
|
872
|
+
" シェルのコマンドマニュアルなどに使える",
|
873
|
+
" [Siri]やチャットボットなどと比べてどうか",
|
874
|
+
" やりたいことを全部言わなくてよい! [★]",
|
875
|
+
" 連文節変換より予測入力の方がラクだとか",
|
876
|
+
" うまくいかないときデータを自分で足せる",
|
877
|
+
" 曖昧検索できる",
|
878
|
+
" 普通にコマンド起動しようとした後でヘルプを表示させ、そのまま実行までできる! [★]",
|
879
|
+
" というのは画期的だと思うのだけど",
|
880
|
+
" コマンドごとにヘルプコマンドを用意する必要がない",
|
881
|
+
" `githelp`というコマンドを用意するようだと使わない",
|
882
|
+
" これは実用的にはとても重要",
|
883
|
+
"",
|
884
|
+
""
|
885
|
+
]
|
886
|
+
},
|
887
|
+
{
|
888
|
+
"title": "Glossary",
|
889
|
+
"created": 1520300002,
|
890
|
+
"updated": 1593830230,
|
891
|
+
"id": "5efae8b60283f300246c8f7a",
|
892
|
+
"lines": [
|
893
|
+
"Glossary",
|
894
|
+
"code:glossary.rb",
|
895
|
+
" def delete; \"(消す|消去する|削除する)\"; end",
|
896
|
+
" def deleted; \"(消した|消去した|削除した)\"; end",
|
897
|
+
" def display; \"(表示する|見る|リストする)\"; end",
|
898
|
+
" def change; \"(変更|修正|編集)\"; end",
|
899
|
+
" def modified; \"(#{change})(された|があった)\"; end",
|
900
|
+
" def compare; \"(比較する|比べる)\"; end",
|
901
|
+
"",
|
902
|
+
"delete: (消す|消去する|削除する)",
|
903
|
+
"display: (表示する|見る|リストする)",
|
904
|
+
"change: (変更|修正|編集|更新)",
|
905
|
+
"modified: (変更|修正|編集|更新)(された|があった)",
|
906
|
+
"compare: (比較する|比べる)",
|
907
|
+
""
|
908
|
+
]
|
909
|
+
},
|
910
|
+
{
|
911
|
+
"title": "一時的に仕事を退避",
|
912
|
+
"created": 1520321191,
|
913
|
+
"updated": 1593834403,
|
914
|
+
"id": "5efae8b60283f300246c8f7b",
|
915
|
+
"lines": [
|
916
|
+
"一時的に仕事を退避",
|
917
|
+
"> まだcommitしていない状態の変更ファイル(addしてる or add していない)が存在する状況で、次のコマンドを実行すると変更ファイルを退避することができる。",
|
918
|
+
"",
|
919
|
+
" $ git: (仕事|変更)を一時的に退避",
|
920
|
+
" % git stash save",
|
921
|
+
""
|
922
|
+
]
|
923
|
+
},
|
924
|
+
{
|
925
|
+
"title": "最近の変更を知る",
|
926
|
+
"created": 1520389238,
|
927
|
+
"updated": 1593830166,
|
928
|
+
"id": "5efae8b60283f300246c8f7c",
|
929
|
+
"lines": [
|
930
|
+
"最近の変更を知る",
|
931
|
+
"$ git: ファイル「(#{gitfiles})」の(#{numbers})分前からの(#{change})履歴を(#{display})",
|
932
|
+
"% git log --since \"#{$2} minutes ago\" #{$1}",
|
933
|
+
"$ git: (#{numbers})分前からのファイル「(#{gitfiles})」の(#{change})履歴を(#{display})",
|
934
|
+
"% git log --since \"#{$1} minutes ago\" #{$2}",
|
935
|
+
"$ git: ファイル「(#{gitfiles})」の(#{numbers})分前からの(#{change})を(#{display})",
|
936
|
+
"% git diff HEAD \"@{#{$2} minutes ago}\" #{$1}",
|
937
|
+
"$ git: (#{numbers})分前からのファイル「(#{gitfiles})」の(#{change})を(#{display})",
|
938
|
+
"% git diff HEAD \"@{#{$1} minutes ago}\" #{$2}",
|
939
|
+
"",
|
940
|
+
"$ git: ファイル「(#{gitfiles})」の(#{numbers})時間前からの(#{change})履歴を(#{display})",
|
941
|
+
"% git log --since \"#{$2} hours ago\" #{$1}",
|
942
|
+
"$ git: (#{numbers})時間前からのファイル「(#{gitfiles})」の(#{change})履歴を(#{display})",
|
943
|
+
"% git log --since \"#{$1} hours ago\" #{$2}",
|
944
|
+
"$ git: ファイル「(#{gitfiles})」の(#{numbers})時間前からの(#{change})を(#{display})",
|
945
|
+
"% git diff HEAD \"@{#{$2} hours ago}\" #{$1}",
|
946
|
+
"$ git: (#{numbers})時間前からのファイル「(#{gitfiles})」の(#{change})を(#{display})",
|
947
|
+
"% git diff HEAD \"@{#{$1} hours ago}\" #{$2}",
|
948
|
+
"",
|
949
|
+
"$ git: ファイル「(#{gitfiles})」の(#{numbers})日前からの(#{change})履歴を(#{display})",
|
950
|
+
"% git log --since \"#{$2} days ago\" #{$1}",
|
951
|
+
"$ git: (#{numbers})日前からのファイル「(#{gitfiles})」の(#{change})履歴を(#{display})",
|
952
|
+
"% git log --since \"#{$1} days ago\" #{$2}",
|
953
|
+
"$ git: ファイル「(#{gitfiles})」の(#{numbers})日前からの(#{change})を(#{display})",
|
954
|
+
"% git diff HEAD \"@{#{$2} days ago}\" #{$1}",
|
955
|
+
"$ git: (#{numbers})日前からのファイル「(#{gitfiles})」の(#{change})を(#{display})",
|
956
|
+
"% git diff HEAD \"@{#{$1} days ago}\" #{$2}",
|
957
|
+
"",
|
958
|
+
"#変更 #修正",
|
959
|
+
""
|
960
|
+
]
|
961
|
+
},
|
962
|
+
{
|
963
|
+
"title": "テンプレート",
|
964
|
+
"created": 1520393146,
|
965
|
+
"updated": 1520393200,
|
966
|
+
"id": "5efae8b60283f300246c8f7d",
|
967
|
+
"lines": [
|
968
|
+
"テンプレート",
|
969
|
+
"> `$ やりたいこと`",
|
970
|
+
"> `% 実際のコマンド`",
|
971
|
+
""
|
972
|
+
]
|
973
|
+
},
|
974
|
+
{
|
975
|
+
"title": "現在の状況",
|
976
|
+
"created": 1520393428,
|
977
|
+
"updated": 1593834430,
|
978
|
+
"id": "5efae8b60283f300246c8f7e",
|
979
|
+
"lines": [
|
980
|
+
"現在の状況",
|
981
|
+
"現在のGitレポジトリの状況を知る",
|
982
|
+
"",
|
983
|
+
"$ git: レポジトリの現在の状況を(#{display})",
|
984
|
+
"% git status",
|
985
|
+
""
|
986
|
+
]
|
987
|
+
},
|
988
|
+
{
|
989
|
+
"title": "branches",
|
990
|
+
"created": 1520394269,
|
991
|
+
"updated": 1593782033,
|
992
|
+
"id": "5efae8b60283f300246c8f7f",
|
993
|
+
"lines": [
|
994
|
+
"branches",
|
995
|
+
"code:branches.rb",
|
996
|
+
" def branches",
|
997
|
+
" list = begin",
|
998
|
+
" `git branch 2> /dev/null`.split(/\\n/)",
|
999
|
+
" rescue",
|
1000
|
+
" []",
|
1001
|
+
" end",
|
1002
|
+
" branches = list.collect { |entry|",
|
1003
|
+
" entry.sub(/^\\s*/,'').sub(/^\\*\\s*/,'')",
|
1004
|
+
" }",
|
1005
|
+
" branches = [\"master\"] if branches.length == 0",
|
1006
|
+
" branches.join(\"|\")",
|
1007
|
+
" end",
|
1008
|
+
"",
|
1009
|
+
""
|
1010
|
+
]
|
1011
|
+
},
|
1012
|
+
{
|
1013
|
+
"title": "Reset関連",
|
1014
|
+
"created": 1520413256,
|
1015
|
+
"updated": 1593834497,
|
1016
|
+
"id": "5efae8b60283f300246c8f80",
|
1017
|
+
"lines": [
|
1018
|
+
" Reset関連",
|
1019
|
+
"$ git: 直前のコミットを取り消す",
|
1020
|
+
"% git reset --soft HEAD^",
|
1021
|
+
"# ファイルは変化しない",
|
1022
|
+
"",
|
1023
|
+
"$ git: ひとつ前のコミットの状態に完全に戻す",
|
1024
|
+
"% git reset --hard HEAD^",
|
1025
|
+
"# ファイルも変化する",
|
1026
|
+
"",
|
1027
|
+
"$ git: コミット後の変更を全部消す",
|
1028
|
+
"% git reset --hard HEAD",
|
1029
|
+
"",
|
1030
|
+
"$ git: すごい昔の状態で動作を確認したい",
|
1031
|
+
"% git reset --hard 昔のコミットのハッシュ値",
|
1032
|
+
"",
|
1033
|
+
"$ git: 直前のリセットをなかったことにする",
|
1034
|
+
"% git reset --hard ORIG_HEAD",
|
1035
|
+
"",
|
1036
|
+
""
|
1037
|
+
]
|
1038
|
+
},
|
1039
|
+
{
|
1040
|
+
"title": "古いバージョンに一時的に戻す",
|
1041
|
+
"created": 1520414345,
|
1042
|
+
"updated": 1593833814,
|
1043
|
+
"id": "5efae8b60283f300246c8f81",
|
1044
|
+
"lines": [
|
1045
|
+
"古いバージョンに一時的に戻す",
|
1046
|
+
"$ git: (#{numbers})個前のバージョンに一時的に戻す",
|
1047
|
+
"% git checkout HEAD~#{$1}",
|
1048
|
+
"",
|
1049
|
+
"$ git: (#{numbers})日前の状態に一時的に戻す",
|
1050
|
+
"% git checkout \"@{#{$1} days ago}\" ",
|
1051
|
+
"",
|
1052
|
+
"$ git: (#{numbers})時間前の状態に一時的に戻す",
|
1053
|
+
"% git checkout \"@{#{$1} hours ago}\" ",
|
1054
|
+
"",
|
1055
|
+
"$ git: (#{numbers})分前の状態に一時的に戻す",
|
1056
|
+
"% git checkout \"@{#{$1} mins ago}\" ",
|
1057
|
+
""
|
1058
|
+
]
|
1059
|
+
},
|
1060
|
+
{
|
1061
|
+
"title": "gitのファイルを大きい順に表示",
|
1062
|
+
"created": 1520435601,
|
1063
|
+
"updated": 1593833870,
|
1064
|
+
"id": "5efae8b60283f300246c8f82",
|
1065
|
+
"lines": [
|
1066
|
+
"gitのファイルを大きい順に表示",
|
1067
|
+
"$ git: ファイルを大きい(順に|順番で)表示する",
|
1068
|
+
"$ git: ファイルを大きさの順に表示する",
|
1069
|
+
"$ git: サイズの順に表示する",
|
1070
|
+
"% git ls-files | xargs du -s | sort -r -n",
|
1071
|
+
"",
|
1072
|
+
""
|
1073
|
+
]
|
1074
|
+
},
|
1075
|
+
{
|
1076
|
+
"title": "gem版の使い方",
|
1077
|
+
"created": 1520471594,
|
1078
|
+
"updated": 1593376467,
|
1079
|
+
"id": "5efae8b60283f300246c8f83",
|
1080
|
+
"lines": [
|
1081
|
+
"gem版の使い方",
|
1082
|
+
"これはgithelpコマンド起動が必要なので、(新)Electron版に以降してしまうつもり (2020/6)",
|
1083
|
+
"",
|
1084
|
+
"[* インストール]",
|
1085
|
+
" `gem install githelp`",
|
1086
|
+
" `githelp`コマンドが入る",
|
1087
|
+
"",
|
1088
|
+
"[* 使い方]",
|
1089
|
+
" データはこのプロジェクトのものを使うが、取得に時間がかかるので`~/.githelp`というJSONファイルを使う",
|
1090
|
+
" `% githelp -u`",
|
1091
|
+
" `~/.githelp`をアップデート",
|
1092
|
+
" `% githelp キーワード`",
|
1093
|
+
" e.g. `% githep 2 表示`",
|
1094
|
+
" `peco`を利用してヘルプを選択",
|
1095
|
+
" `% githelp -t キーワード`",
|
1096
|
+
" `peco`のかわりに`more`で表示",
|
1097
|
+
"",
|
1098
|
+
" `peco`は以下から入手",
|
1099
|
+
" https://github.com/peco/peco/releases",
|
1100
|
+
" Macだと`brew install peco`",
|
1101
|
+
""
|
1102
|
+
]
|
1103
|
+
},
|
1104
|
+
{
|
1105
|
+
"title": "リモートブランチを消す",
|
1106
|
+
"created": 1520475270,
|
1107
|
+
"updated": 1520475341,
|
1108
|
+
"id": "5efae8b60283f300246c8f84",
|
1109
|
+
"lines": [
|
1110
|
+
"リモートブランチを消す",
|
1111
|
+
" どうやるの?",
|
1112
|
+
"",
|
1113
|
+
"#ブランチ",
|
1114
|
+
""
|
1115
|
+
]
|
1116
|
+
},
|
1117
|
+
{
|
1118
|
+
"title": "文字列がはじめて出現したバージョンを捜す",
|
1119
|
+
"created": 1520512154,
|
1120
|
+
"updated": 1593833826,
|
1121
|
+
"id": "5efae8b60283f300246c8f85",
|
1122
|
+
"lines": [
|
1123
|
+
"文字列がはじめて出現したバージョンを捜す",
|
1124
|
+
" `git grep`で出現ファイルをリストして最古のものを`tail -1`で取得すればいいと思う",
|
1125
|
+
" そういうことをするコマンドが有るかもしれないけど",
|
1126
|
+
"",
|
1127
|
+
"$ git: (#{params})という文字列がはじめて出現した(バージョン|コミット)の情報を(#{display})",
|
1128
|
+
"% git log -1 `git rev-list --all | xargs git grep '#{$1}' | tail -1 | ruby -e \"STDIN.each {|line| puts line[0..39] }\"`",
|
1129
|
+
"",
|
1130
|
+
"$ git: (#{params})という文字列がはじめて出現した(バージョン|コミット)に一時的に戻す",
|
1131
|
+
"% git checkout `git rev-list --all | xargs git grep '#{$1}' | tail -1 | ruby -e \"STDIN.each {|line| puts line[0..39] }\"`",
|
1132
|
+
""
|
1133
|
+
]
|
1134
|
+
},
|
1135
|
+
{
|
1136
|
+
"title": "gitコマンドに関する疑問",
|
1137
|
+
"created": 1520553294,
|
1138
|
+
"updated": 1593375969,
|
1139
|
+
"id": "5efae8b60283f300246c8f88",
|
1140
|
+
"lines": [
|
1141
|
+
"gitコマンドに関する疑問",
|
1142
|
+
" 古いファイルを見る簡単な方法が無い?",
|
1143
|
+
" `git show HEAD^^:file` とかするのか?",
|
1144
|
+
" なんでコロンが要るの?",
|
1145
|
+
" 別のコマンドあるのか?",
|
1146
|
+
" `show`と`cat-file`はどう違う?",
|
1147
|
+
" 「[バージョン]」という用語はあるか?",
|
1148
|
+
" 「ひとつ前のバージョン」と言うのは不正確だろうか?",
|
1149
|
+
" ひとつ前の変更なのかひとつ前のコミットなのかわからないような",
|
1150
|
+
" コミット番号、リビジョン番号、バージョン番号、のおような言葉はあるか?",
|
1151
|
+
""
|
1152
|
+
]
|
1153
|
+
},
|
1154
|
+
{
|
1155
|
+
"title": "最近編集したファイルのリストを表示する",
|
1156
|
+
"created": 1520553828,
|
1157
|
+
"updated": 1593834725,
|
1158
|
+
"id": "5efae8b60283f300246c8f89",
|
1159
|
+
"lines": [
|
1160
|
+
"最近編集したファイルのリストを表示する",
|
1161
|
+
" [新しい順にファイルを表示] でいいのか?",
|
1162
|
+
" これだと全部表示されてしまう",
|
1163
|
+
" 2日前から変更されたファイル とかの場合は?",
|
1164
|
+
"",
|
1165
|
+
"以下のようにすればOKっぽい 2018/3/9 09:14",
|
1166
|
+
"",
|
1167
|
+
"$ git: (#{numbers})分前(から|以降に)(#{modified})ファイルをリストする",
|
1168
|
+
"% git diff --name-only '@{#{$1} minutes ago}'",
|
1169
|
+
"",
|
1170
|
+
"$ git: (#{numbers})時間前(から|以降に)(#{modified})ファイルをリストする",
|
1171
|
+
"% git diff --name-only '@{#{$1} hours ago}'",
|
1172
|
+
"",
|
1173
|
+
"$ git: (#{numbers})日前(から|以降に)(#{modified})ファイルをリストする",
|
1174
|
+
"% git diff --name-only '@{#{$1} days ago}'",
|
1175
|
+
"",
|
1176
|
+
"$ git: (#{numbers})日前からの変更を(#{display})",
|
1177
|
+
"% git log --stat --since=\"#{$1} days ago\"",
|
1178
|
+
""
|
1179
|
+
]
|
1180
|
+
},
|
1181
|
+
{
|
1182
|
+
"title": "編集中のファイルをリストする",
|
1183
|
+
"created": 1520554104,
|
1184
|
+
"updated": 1593833508,
|
1185
|
+
"id": "5efae8b60283f300246c8f8a",
|
1186
|
+
"lines": [
|
1187
|
+
"編集中のファイルをリストする",
|
1188
|
+
"$ git: 編集中のファイルをリストする",
|
1189
|
+
"% git ls-files -m",
|
1190
|
+
""
|
1191
|
+
]
|
1192
|
+
},
|
1193
|
+
{
|
1194
|
+
"title": "編集中のファイル",
|
1195
|
+
"created": 1520749502,
|
1196
|
+
"updated": 1593834360,
|
1197
|
+
"id": "5efae8b60283f300246c8f8b",
|
1198
|
+
"lines": [
|
1199
|
+
"編集中のファイル",
|
1200
|
+
" 編集はしているがまだ[コミット]していない状態のファイル",
|
1201
|
+
" `$ git status`で確認できる",
|
1202
|
+
"",
|
1203
|
+
"$ git: 現在の編集状態を(#{display})",
|
1204
|
+
"$ git: 編集中のファイルを(#{display})",
|
1205
|
+
"% git status",
|
1206
|
+
""
|
1207
|
+
]
|
1208
|
+
},
|
1209
|
+
{
|
1210
|
+
"title": "コミットID",
|
1211
|
+
"created": 1520749665,
|
1212
|
+
"updated": 1520756477,
|
1213
|
+
"id": "5efae8b60283f300246c8f8c",
|
1214
|
+
"lines": [
|
1215
|
+
"コミットID",
|
1216
|
+
" [コミット]を識別するための40桁のSHA1値",
|
1217
|
+
""
|
1218
|
+
]
|
1219
|
+
},
|
1220
|
+
{
|
1221
|
+
"title": "バージョン指定",
|
1222
|
+
"created": 1520749685,
|
1223
|
+
"updated": 1593558596,
|
1224
|
+
"id": "5efae8b60283f300246c8f8d",
|
1225
|
+
"lines": [
|
1226
|
+
"バージョン指定",
|
1227
|
+
" いろいろある",
|
1228
|
+
"",
|
1229
|
+
"#バージョン",
|
1230
|
+
""
|
1231
|
+
]
|
1232
|
+
},
|
1233
|
+
{
|
1234
|
+
"title": "コミット",
|
1235
|
+
"created": 1520756436,
|
1236
|
+
"updated": 1520756455,
|
1237
|
+
"id": "5efae8b60283f300246c8f8e",
|
1238
|
+
"lines": [
|
1239
|
+
"コミット",
|
1240
|
+
" [レポジトリ]に現在の状況を登録すること",
|
1241
|
+
""
|
1242
|
+
]
|
1243
|
+
},
|
1244
|
+
{
|
1245
|
+
"title": "レポジトリ",
|
1246
|
+
"created": 1520756497,
|
1247
|
+
"updated": 1520756506,
|
1248
|
+
"id": "5efae8b60283f300246c8f8f",
|
1249
|
+
"lines": [
|
1250
|
+
"レポジトリ",
|
1251
|
+
" 編集履歴を格納しているデータベース",
|
1252
|
+
""
|
1253
|
+
]
|
1254
|
+
},
|
1255
|
+
{
|
1256
|
+
"title": "Gitのマニュアルページ",
|
1257
|
+
"created": 1520761305,
|
1258
|
+
"updated": 1520761420,
|
1259
|
+
"id": "5efae8b60283f300246c8f90",
|
1260
|
+
"lines": [
|
1261
|
+
"Gitのマニュアルページ",
|
1262
|
+
"code:git_wc.txt",
|
1263
|
+
" % wc /Applications/Xcode.app/Contents/Developer/usr/share/man/man1/git*",
|
1264
|
+
" 448 2752 16669 /Applications/Xcode.app/Contents/Developer/usr/share/man/man1/git-add.1",
|
1265
|
+
" 314 1390 9580 /Applications/Xcode.app/Contents/Developer/usr/share/man/man1/git-am.1",
|
1266
|
+
" .....",
|
1267
|
+
" 488 2992 20556 /Applications/Xcode.app/Contents/Developer/usr/share/man/man1/gitremote-helpers.1",
|
1268
|
+
" 1015 4082 29249 /Applications/Xcode.app/Contents/Developer/usr/share/man/man1/gitweb.1",
|
1269
|
+
" 63628 287847 1896130 total",
|
1270
|
+
" %",
|
1271
|
+
"",
|
1272
|
+
"6万行もある!",
|
1273
|
+
""
|
1274
|
+
]
|
1275
|
+
},
|
1276
|
+
{
|
1277
|
+
"title": "アイデア",
|
1278
|
+
"created": 1520819819,
|
1279
|
+
"updated": 1520821739,
|
1280
|
+
"id": "5efae8b60283f300246c8f91",
|
1281
|
+
"lines": [
|
1282
|
+
"アイデア",
|
1283
|
+
" gitのmanページにちょろっと追加するだけでGitHelpになったりしないか?",
|
1284
|
+
" gitのmanページはデカいので嫌だけど",
|
1285
|
+
""
|
1286
|
+
]
|
1287
|
+
},
|
1288
|
+
{
|
1289
|
+
"title": "操作履歴",
|
1290
|
+
"created": 1520857381,
|
1291
|
+
"updated": 1593834473,
|
1292
|
+
"id": "5efae8b60283f300246c8f92",
|
1293
|
+
"lines": [
|
1294
|
+
"操作履歴",
|
1295
|
+
"$ git: 過去のあらゆる操作履歴を見る",
|
1296
|
+
"% git reflog",
|
1297
|
+
"",
|
1298
|
+
"$ git: 過去のコミット履歴を見る",
|
1299
|
+
"% git log",
|
1300
|
+
"",
|
1301
|
+
""
|
1302
|
+
]
|
1303
|
+
},
|
1304
|
+
{
|
1305
|
+
"title": "Electron版GitHelp (2018版)",
|
1306
|
+
"created": 1521610744,
|
1307
|
+
"updated": 1593375138,
|
1308
|
+
"id": "5efae8b60283f300246c8f93",
|
1309
|
+
"lines": [
|
1310
|
+
"Electron版GitHelp (2018版)",
|
1311
|
+
"Macでしか動かないしセットアップが超大変なのでもう使わないことにする (2020/6)",
|
1312
|
+
"",
|
1313
|
+
"[https://www.youtube.com/watch?v=B4RQHHS3-cs]",
|
1314
|
+
"",
|
1315
|
+
" IMEのように動きます",
|
1316
|
+
" ターミナル上でショートカットキーを押すとGitHelpウィンドウが表示され、パラメタを入力するとマッチするものがフィルタリングされます",
|
1317
|
+
" マウスやキーボード(Ctrl-P/CtrlpN)で選択してリターンを押すとコマンドがペーストされます",
|
1318
|
+
" それでよければリターンを押して実行します",
|
1319
|
+
"",
|
1320
|
+
"[*** インストール]",
|
1321
|
+
" `bash` が動く`Terminal.app`で動かして下さい",
|
1322
|
+
" [https://github.com/masui/GitHelp GitHubのデータ]をcloneします",
|
1323
|
+
" % git clone git@github.com:masui/GitHelp.git",
|
1324
|
+
" appフォルダでmakeします",
|
1325
|
+
" % cd GitHelp/app; make",
|
1326
|
+
" 動かす必要があれば、appフォルダ全体をどこかにコピーします",
|
1327
|
+
" % cp -r ../app /Your/Directory",
|
1328
|
+
" 以下のスクリプトを`~/.bash_profile`にコピーします",
|
1329
|
+
" `GITHELPDIR`は先程のappフォルダがある場所を指定します",
|
1330
|
+
" code:.bash_profile.sh",
|
1331
|
+
" #",
|
1332
|
+
" # GitHelp",
|
1333
|
+
" #",
|
1334
|
+
" export GITHELPDIR=/Your/Directory/app",
|
1335
|
+
" # プロンプトが表示されるたびにカーソル位置とカレントディレクトリをセーブする",
|
1336
|
+
" function githelp_save_env(){",
|
1337
|
+
" ${GITHELPDIR}/cursorpos > /tmp/githelp.cursorpos",
|
1338
|
+
" pwd > /tmp/githelp.pwd",
|
1339
|
+
" }",
|
1340
|
+
" PROMPT_COMMAND=githelp_save_env",
|
1341
|
+
" ",
|
1342
|
+
" # Ctrl-Lを押したときPROMPT_COMMANDが動かないので別扱いする",
|
1343
|
+
" function githelp_save_env_clear(){",
|
1344
|
+
" clear",
|
1345
|
+
" ${GITHELPDIR}/cursorpos > /tmp/githelp.cursorpos",
|
1346
|
+
" pwd > /tmp/githelp.pwd",
|
1347
|
+
" }",
|
1348
|
+
" bind -x '\"\\C-l\": githelp_save_env_clear'",
|
1349
|
+
" `Automator`を起動して新しい`サービス`を作ります",
|
1350
|
+
" [https://gyazo.com/5a10c6a6aea94e45c5d2b01e33466149]",
|
1351
|
+
" `ユーティリティ ⇒ シェルスクリプトを実行` で以下のスクリプトを登録します",
|
1352
|
+
" code:automator.sh",
|
1353
|
+
" source ~/.bash_profile",
|
1354
|
+
" electron ${GITHELPDIR}",
|
1355
|
+
" [https://gyazo.com/846c39623575db1251924ca889d20d43]",
|
1356
|
+
" `システム環境設定`の`キーボード ⇒ ショートカット ⇒ サービス`でGitHelpに適当なショートカットキーを割り当てます",
|
1357
|
+
" [https://gyazo.com/5c9c106befaeec27ca2ef70595885e6b]",
|
1358
|
+
" セキュリティとプライバシー ⇒ プライバシー ⇒ アクセシビリティ でapplescript実行を許す設定が必要かも",
|
1359
|
+
" これで「Ctrl-Cmd-G」でGitHelpウインドウが出るようになります",
|
1360
|
+
"",
|
1361
|
+
"[** Issues]",
|
1362
|
+
" `% git ma` などと入力してから起動できると良いかも",
|
1363
|
+
" git以外(e.g. `ffmpeg`)でも使えるようになるし",
|
1364
|
+
""
|
1365
|
+
]
|
1366
|
+
},
|
1367
|
+
{
|
1368
|
+
"title": "ブランチのリストを更新日時順に表示する",
|
1369
|
+
"created": 1525019802,
|
1370
|
+
"updated": 1593833469,
|
1371
|
+
"id": "5efae8b60283f300246c8f94",
|
1372
|
+
"lines": [
|
1373
|
+
"ブランチのリストを更新日時順に表示する",
|
1374
|
+
"$ git: ブランチのリストを更新日時順に表示する",
|
1375
|
+
"% git branch --sort=committerdate",
|
1376
|
+
""
|
1377
|
+
]
|
1378
|
+
},
|
1379
|
+
{
|
1380
|
+
"title": "鎌倉の天気",
|
1381
|
+
"created": 1593557439,
|
1382
|
+
"updated": 1593565062,
|
1383
|
+
"id": "5efbc1bde39afa001e86057f",
|
1384
|
+
"lines": [
|
1385
|
+
"鎌倉の天気",
|
1386
|
+
"$ 鎌倉の天気",
|
1387
|
+
"% open https://tenki.jp/forecast/3/17/4610/14204/3hours.html",
|
1388
|
+
"",
|
1389
|
+
"$ 鎌倉の雨の様子を見る",
|
1390
|
+
"% open https://tokyo-ame.jwa.or.jp/",
|
1391
|
+
"",
|
1392
|
+
"#天気 #鎌倉",
|
1393
|
+
""
|
1394
|
+
]
|
1395
|
+
},
|
1396
|
+
{
|
1397
|
+
"title": "ファイルのソート",
|
1398
|
+
"created": 1593558363,
|
1399
|
+
"updated": 1593558424,
|
1400
|
+
"id": "5efbc559776a1f00251fc230",
|
1401
|
+
"lines": [
|
1402
|
+
"ファイルのソート",
|
1403
|
+
"$ 新しい順にファイルをソートする",
|
1404
|
+
"% ls -l -t",
|
1405
|
+
"",
|
1406
|
+
"$ 大きさの順にファイルをソートする",
|
1407
|
+
"% ls -l | sort -r -k 5",
|
1408
|
+
"",
|
1409
|
+
""
|
1410
|
+
]
|
1411
|
+
},
|
1412
|
+
{
|
1413
|
+
"title": "湘南台のラーメン",
|
1414
|
+
"created": 1593558836,
|
1415
|
+
"updated": 1593559101,
|
1416
|
+
"id": "5efbc732381ca80025d68b20",
|
1417
|
+
"lines": [
|
1418
|
+
"湘南台のラーメン",
|
1419
|
+
"$ 湘南台のラーメン情報",
|
1420
|
+
"% open https://scrapbox.io/SFCHelp/ラーメン",
|
1421
|
+
""
|
1422
|
+
]
|
1423
|
+
},
|
1424
|
+
{
|
1425
|
+
"title": "ASCIIコード表",
|
1426
|
+
"created": 1593558910,
|
1427
|
+
"updated": 1593558921,
|
1428
|
+
"id": "5efbc77d04ee58001e1ced47",
|
1429
|
+
"lines": [
|
1430
|
+
"ASCIIコード表",
|
1431
|
+
"$ ASCIIコードを調べる",
|
1432
|
+
"% open https://www.k-cube.co.jp/wakaba/server/ascii_code.html",
|
1433
|
+
""
|
1434
|
+
]
|
1435
|
+
},
|
1436
|
+
{
|
1437
|
+
"title": "Amazon新刊漫画",
|
1438
|
+
"created": 1593559493,
|
1439
|
+
"updated": 1593559523,
|
1440
|
+
"id": "5efbc9c234d4bb0023ada277",
|
1441
|
+
"lines": [
|
1442
|
+
"Amazon新刊漫画",
|
1443
|
+
"$ Amazon新刊漫画ランキング",
|
1444
|
+
"% open https://www.amazon.co.jp/gp/new-releases/books/2501045051/",
|
1445
|
+
"",
|
1446
|
+
"#漫画 #Amazon",
|
1447
|
+
""
|
1448
|
+
]
|
1449
|
+
},
|
1450
|
+
{
|
1451
|
+
"title": "自分の場所を調べる",
|
1452
|
+
"created": 1593559548,
|
1453
|
+
"updated": 1593559612,
|
1454
|
+
"id": "5efbc9fae39afa001e860a97",
|
1455
|
+
"lines": [
|
1456
|
+
"自分の場所を調べる",
|
1457
|
+
"$ 今いる場所の地図を開く",
|
1458
|
+
"$ 現在地の地図を見る",
|
1459
|
+
"$ 自分がどこにいるのか調べる",
|
1460
|
+
"$ 自分の場所を調べる",
|
1461
|
+
"% whereami",
|
1462
|
+
""
|
1463
|
+
]
|
1464
|
+
},
|
1465
|
+
{
|
1466
|
+
"title": "Amazonのパスワード",
|
1467
|
+
"created": 1593559633,
|
1468
|
+
"updated": 1593565098,
|
1469
|
+
"id": "5efbca4f95fe75001ee7879e",
|
1470
|
+
"lines": [
|
1471
|
+
"Amazonのパスワード",
|
1472
|
+
"$ Amazonのパスワードを計算",
|
1473
|
+
"% open http://pitecan.com/p/Amazon_masui@pitecan.com.html",
|
1474
|
+
"",
|
1475
|
+
"#Amazon #パスワード",
|
1476
|
+
""
|
1477
|
+
]
|
1478
|
+
},
|
1479
|
+
{
|
1480
|
+
"title": "Gyazo画像を検索する",
|
1481
|
+
"created": 1593559716,
|
1482
|
+
"updated": 1593784209,
|
1483
|
+
"id": "5efbcaa1d618d4001ed75161",
|
1484
|
+
"lines": [
|
1485
|
+
"Gyazo画像を検索する",
|
1486
|
+
"$ Gyazoで(#{params})を検索する",
|
1487
|
+
"% open https://gyazo.com/search/'#{$1}'",
|
1488
|
+
"",
|
1489
|
+
"#Gyazo",
|
1490
|
+
""
|
1491
|
+
]
|
1492
|
+
},
|
1493
|
+
{
|
1494
|
+
"title": "zshの設定",
|
1495
|
+
"created": 1593560802,
|
1496
|
+
"updated": 1593560812,
|
1497
|
+
"id": "5efbcedf552cee001e472a6f",
|
1498
|
+
"lines": [
|
1499
|
+
"zshの設定",
|
1500
|
+
"$ zshの設定を調べる",
|
1501
|
+
"% open https://creepfablic.site/2019/10/13/bash-zsh/",
|
1502
|
+
""
|
1503
|
+
]
|
1504
|
+
},
|
1505
|
+
{
|
1506
|
+
"title": "コマンドライン版",
|
1507
|
+
"created": 1593591715,
|
1508
|
+
"updated": 1593822090,
|
1509
|
+
"id": "5efc479d16b02a0038ec51ac",
|
1510
|
+
"lines": [
|
1511
|
+
"コマンドライン版",
|
1512
|
+
" [GitHelp]の最初の(?)バージョン",
|
1513
|
+
" `% helpline 2 Makefile` みたいにコマンドラインで呼び出す",
|
1514
|
+
" Ruby実装",
|
1515
|
+
" Pecoでリストして選択",
|
1516
|
+
""
|
1517
|
+
]
|
1518
|
+
},
|
1519
|
+
{
|
1520
|
+
"title": "画像の回転",
|
1521
|
+
"created": 1593765364,
|
1522
|
+
"updated": 1593803094,
|
1523
|
+
"id": "5efeedf3ee088b001e89c862",
|
1524
|
+
"lines": [
|
1525
|
+
"画像の回転",
|
1526
|
+
"$ (#{imagefiles})を90度回転して(#{params})を作成",
|
1527
|
+
"% convert #{$1} -rotate +90 #{$2}",
|
1528
|
+
"",
|
1529
|
+
"パラメタ取得できるようにしないと...",
|
1530
|
+
"",
|
1531
|
+
"#画像",
|
1532
|
+
""
|
1533
|
+
]
|
1534
|
+
},
|
1535
|
+
{
|
1536
|
+
"title": "ファイルリスト",
|
1537
|
+
"created": 1593802544,
|
1538
|
+
"updated": 1593836878,
|
1539
|
+
"id": "5eff7f2ea37505001e710149",
|
1540
|
+
"lines": [
|
1541
|
+
"ファイルリスト",
|
1542
|
+
"引数の中にファイル名とマッチするものがあればファイルリストを取得 ",
|
1543
|
+
"",
|
1544
|
+
"code:files.rb",
|
1545
|
+
" def files(argv=ARGV)",
|
1546
|
+
" list = `ls -1 2> /dev/null`.split(/\\n/)",
|
1547
|
+
" matched = {}",
|
1548
|
+
" list.each { |file|",
|
1549
|
+
" if argv.length == 0",
|
1550
|
+
" matched[file] = true",
|
1551
|
+
" else",
|
1552
|
+
" # args(argv).each { |arg|",
|
1553
|
+
" argv[0].split(/\\s/).each { |arg|",
|
1554
|
+
" matched[file] = true if /#{arg}/i =~ file",
|
1555
|
+
" }",
|
1556
|
+
" end",
|
1557
|
+
" }",
|
1558
|
+
" files = matched.keys",
|
1559
|
+
" files = [\"voidvoidvoid\"] if files.length == 0",
|
1560
|
+
" \"(\" + files.join(\"|\") + \")\"",
|
1561
|
+
" end",
|
1562
|
+
"",
|
1563
|
+
"[引数パラメタ]",
|
1564
|
+
""
|
1565
|
+
]
|
1566
|
+
},
|
1567
|
+
{
|
1568
|
+
"title": "画像ファイルリスト",
|
1569
|
+
"created": 1593802896,
|
1570
|
+
"updated": 1593836855,
|
1571
|
+
"id": "5eff808e1dc30e001e752bb8",
|
1572
|
+
"lines": [
|
1573
|
+
"画像ファイルリスト",
|
1574
|
+
"画像だけリストする",
|
1575
|
+
"",
|
1576
|
+
"code:imagefiles.rb",
|
1577
|
+
" def imagefiles(argv=ARGV)",
|
1578
|
+
" list = `ls -1`.split(/\\n/)",
|
1579
|
+
" matched = {}",
|
1580
|
+
" list.each { |file|",
|
1581
|
+
" if file =~ /\\.(jpg|jpeg|png|gif)$/i",
|
1582
|
+
" if argv.length == 0",
|
1583
|
+
" matched[file] = true",
|
1584
|
+
" else",
|
1585
|
+
" # args(argv).each { |arg|",
|
1586
|
+
" argv[0].split(/\\s/).each { |arg|",
|
1587
|
+
" matched[file] = true if file =~ /#{arg}/i",
|
1588
|
+
" }",
|
1589
|
+
" end",
|
1590
|
+
" end",
|
1591
|
+
" }",
|
1592
|
+
" files = matched.keys",
|
1593
|
+
" files = [\"voidvoidvoid\"] if files.length == 0",
|
1594
|
+
" \"(\" + files.join(\"|\") + \")\"",
|
1595
|
+
" end",
|
1596
|
+
"",
|
1597
|
+
"[引数パラメタ]",
|
1598
|
+
""
|
1599
|
+
]
|
1600
|
+
},
|
1601
|
+
{
|
1602
|
+
"title": "反響があったツイートをリストする",
|
1603
|
+
"created": 1593938525,
|
1604
|
+
"updated": 1593960345,
|
1605
|
+
"id": "5f01925bd6e98300243cf03a",
|
1606
|
+
"lines": [
|
1607
|
+
"反響があったツイートをリストする",
|
1608
|
+
"$ (#{params})以上の反響があったツイートをリストする",
|
1609
|
+
"% open 'https://twitter.com/search?q=from%3Amasui%20min_retweets%3A#{$1}&src=typed_query&f=live'",
|
1610
|
+
"",
|
1611
|
+
"# $ 反響があったツイートをリストする",
|
1612
|
+
"# % open 'https://twitter.com/search?q=from%3Amasui%20min_retweets%3A25&src=typed_query&f=live'",
|
1613
|
+
""
|
1614
|
+
]
|
1615
|
+
},
|
1616
|
+
{
|
1617
|
+
"title": "HelpLineでサポートするヘルプ",
|
1618
|
+
"created": 1593558325,
|
1619
|
+
"updated": 1593822143,
|
1620
|
+
"id": "5efbc532552cee001e4728b5",
|
1621
|
+
"lines": [
|
1622
|
+
"HelpLineでサポートするヘルプ",
|
1623
|
+
"[増井俊之.icon]",
|
1624
|
+
" コマンド拡張だけではなく、汎用に使う",
|
1625
|
+
" シェルが「万能お助けテキストエリア」になる",
|
1626
|
+
" コマンドとかキーワードとかを入力した後でCtrl-Jを押すとそれを実現するコマンドが提示されて実行可能になる",
|
1627
|
+
" 「じぶん用Helpfeel」みたいになるかも",
|
1628
|
+
"",
|
1629
|
+
"[[コマンドが複雑な場合]]",
|
1630
|
+
" `git`, `ffmpeg`, `convert`, `rsync` など引数が難しいコマンド全部で使える",
|
1631
|
+
"",
|
1632
|
+
"[[やり方がよくわからない場合]] (コマンド名などがわからない場合)",
|
1633
|
+
" abc.jpgを90度回転する",
|
1634
|
+
" `abc.jpg 90度 回転`",
|
1635
|
+
" 大きなファイルを消す",
|
1636
|
+
" `find` + `rm` ?",
|
1637
|
+
" abcという文字があるファイルをさがす",
|
1638
|
+
" `ls`, `find`, `grep`",
|
1639
|
+
" 新しい順にファイルを表示する",
|
1640
|
+
" `ls -t`",
|
1641
|
+
" ファイルをutf-8にする",
|
1642
|
+
" `nkf`",
|
1643
|
+
" サイズ順にファイルを表示",
|
1644
|
+
" `ls -l | sort -r -k 5`",
|
1645
|
+
" 自分のファイル全体から調べるなんてのも便利そう",
|
1646
|
+
" どこかの天気を知る",
|
1647
|
+
" `% 鎌倉 天気`",
|
1648
|
+
" いま何時?",
|
1649
|
+
" `date`",
|
1650
|
+
" Helpfeelを使う",
|
1651
|
+
" `% crew 泥酔`みたいな",
|
1652
|
+
"",
|
1653
|
+
"[[[増井俊之.icon] 専用のもの]]",
|
1654
|
+
" abc.txt をS3にアップロードする",
|
1655
|
+
" `~/bin/upload abc.txt`",
|
1656
|
+
" pitecan.comにログインする",
|
1657
|
+
" `ssh pitecan.com`",
|
1658
|
+
" [Amazonのパスワード] [/icons/check.icon]",
|
1659
|
+
" `open http://pitecan.com/p/Amazon_masui@pitecan.com.html`",
|
1660
|
+
" [Gyazo画像を検索する]",
|
1661
|
+
" EpisoPass問題を新しく生成する",
|
1662
|
+
" `~/bin/episoq`",
|
1663
|
+
" 予定表データを作る",
|
1664
|
+
" `~/bin/month 8 2020`",
|
1665
|
+
" [自分の場所を調べる]",
|
1666
|
+
" `~/bin/whereami`",
|
1667
|
+
"",
|
1668
|
+
"[[コマンドラインと関係ないもの]]",
|
1669
|
+
" Amazonで新刊漫画を見る",
|
1670
|
+
" [鎌倉の天気]を調べる [/icons/check.icon]",
|
1671
|
+
" [湘南台のラーメン]は? [/icons/check.icon]",
|
1672
|
+
" 人気のある店を知る",
|
1673
|
+
" 「`&`」のASCIIコードは? [/icons/check.icon]",
|
1674
|
+
" [/SFCHelp]も使える",
|
1675
|
+
"",
|
1676
|
+
"[[感想]]",
|
1677
|
+
" Unixコマンドとあんまり関係なく使える気がしてきた",
|
1678
|
+
" あらゆる分野で自分の知見/Tipsをどんどん入れておいて呼び出すためのシステム",
|
1679
|
+
" メモっておくと後でコマンドラインから呼び出されるような",
|
1680
|
+
" 自分用のヘルプを自分で作る",
|
1681
|
+
" ググって役にたったものはヘルプに入れておくとか",
|
1682
|
+
" コマンドラインで `% 鎌倉 天気` などと入力してから `open https://tenki.jp/forecast/3/17/4610/14204/3hours.html` がサジェストされたりする",
|
1683
|
+
" 「zsh風のお助けシステム」を使う感覚になるかも",
|
1684
|
+
"",
|
1685
|
+
"#やりたいことの例",
|
1686
|
+
""
|
1687
|
+
]
|
1688
|
+
}
|
1689
|
+
]
|
1690
|
+
}
|