githelp 0.1.3 → 0.1.4
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/.gitignore +1 -0
- data/README.md +72 -26
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/data/cat-file.rb +4 -0
- data/data/checkout.rb +1 -1
- data/exe/githelp +3 -2
- data/lib/githelp/version.rb +1 -1
- data/lib/githelp.rb +0 -41
- metadata +4 -4
- data/Makefile +0 -6
- data/README-gem.md +0 -41
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b44761785f5b8f6abed97dd864aea2e911e5f0d5
|
4
|
+
data.tar.gz: b6c93ae5afa51e4c494889b34972b4c3e4925a91
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: adea99c99d34a612f79debe607244654dea9cb109a0a4a417b263cde33c40d0d3f63aa892ee5a5e151f94907cd1f9907db163c7d1180dfbdbc2020a468cff2ab
|
7
|
+
data.tar.gz: d850c7a51e1088e84fce305ba7ea7f1a12c9f4763bffd7a08d436b26659a3a6f6c16a2415e41047d2306532675345ef57b8d8525537a3bb4c3dd1a507fd6d7b4
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,23 +1,35 @@
|
|
1
1
|
# GitHelp
|
2
2
|
|
3
|
-
**Git
|
3
|
+
**Gitのコマンドの使いこなしを支援**
|
4
4
|
|
5
|
-
###
|
5
|
+
### 概要
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
Gitのような複雑なシステムは使い方がわからなくて苦労する。
|
8
|
+
ある程度使い方を知っている場合でも
|
9
|
+
あまり標準的でない操作は難しい。
|
10
|
+
たとえば以下のような場合は
|
11
|
+
どういうコマンドを使えばいいだろうか?
|
9
12
|
|
10
|
-
|
11
|
-
|
12
|
-
* example.txtは3日前からどう変わった?
|
13
|
-
* 3日前のexample.txtを見たい
|
13
|
+
* README.mdは3日前からどう変わった?
|
14
|
+
* 3日前のREADME.mdを見たい
|
14
15
|
* package.jsonからcoffeeという名前が消えたのはいつ?
|
15
16
|
* ここ1週間ぐらい変更されてないファイルは?
|
16
17
|
* 最近最も大量に修正したファイルはどれだっけ?
|
17
18
|
|
19
|
+
複雑なシステムにはヘルプやマニュアルが用意されているのが普通だし、
|
20
|
+
FAQや逆引き辞典が用意されていることもあるし、
|
21
|
+
答がWebでみつかることもあるが、
|
22
|
+
うまく検索できないことも多いし、
|
23
|
+
やり方がわかった場合でも
|
24
|
+
キーワードやパラメタを指定して実行しなおす必要があるので手間がかかる。
|
25
|
+
***このような問題を[ExpandHelp](http://www.interaction-ipsj.org/archives/paper2012/data/Interaction2012/oral/data/pdf/12INT012.pdf)で解決する。***
|
26
|
+
|
18
27
|
### 利用例
|
19
28
|
|
20
|
-
|
29
|
+
Gitに関連するタスクのキーワードやパラメタを指定すると
|
30
|
+
候補のリストが表示され、選択すると実行される。
|
31
|
+
|
32
|
+
* ```README``` ```8``` ```比較``` のような引数を指定して```githelp```コマンドを起動すると以下のような候補リストが提示される
|
21
33
|
|
22
34
|
```
|
23
35
|
$ githelp README 8 比較
|
@@ -30,7 +42,7 @@ $ githelp README 8 比較
|
|
30
42
|
$
|
31
43
|
```
|
32
44
|
|
33
|
-
* ```-x```
|
45
|
+
* ```-x``` オプションで```2```のような数字を指定すると実行できる
|
34
46
|
|
35
47
|
|
36
48
|
```
|
@@ -45,35 +57,69 @@ index 862f185..34c8907 100644
|
|
45
57
|
-**Gitのコマンドの使いこなしを支援する**
|
46
58
|
-
|
47
59
|
-### 解決したい問題
|
48
|
-
-
|
49
|
-
-* Gitの使い方や引数指定方法がさっぱりわからないこと
|
50
|
-
-* ちょっとしたことでもどうコマンドを組み合わせれば良いのかわからないこと
|
51
60
|
...
|
52
61
|
```
|
53
62
|
|
54
63
|
* ```-i``` オプションを指定すると対話的に選択できる
|
55
|
-
* 引数なしで```githelp```を起動するとリストが表示される
|
56
64
|
|
65
|
+
### インストール
|
57
66
|
|
58
|
-
|
67
|
+
```
|
68
|
+
% gem install githelp
|
69
|
+
```
|
59
70
|
|
60
|
-
|
61
|
-
* [ExpandHelp論文](http://www.interaction-ipsj.org/archives/paper2012/data/Interaction2012/oral/data/pdf/12INT012.pdf)
|
62
|
-
* [```data```](https://github.com/masui/GitHelp/tree/master/data)ディレクトリの下に問題パタンと解決コマンドを書く
|
63
|
-
* ワンライナーで無理な場合は ```bin``` の下にコマンドを用意する
|
71
|
+
### 実装
|
64
72
|
|
65
|
-
|
73
|
+
* [re_expand](https://github.com/masui/expand_ruby)
|
74
|
+
という正規表現展開ライブラリを利用
|
75
|
+
* [```data```](https://github.com/masui/GitHelp/tree/master/data)ディレクトリの下に**問題パタン**と**解決コマンド**を並べたものを用意しておく
|
66
76
|
|
67
77
|
```
|
68
|
-
|
78
|
+
[
|
79
|
+
"「(#{files.join('|')})」ファイルを(#{numbers.join('|')})分前の(もの|バージョン)と比較する",
|
80
|
+
'git diff HEAD "@{#{$2} minutes ago}" #{$1}'
|
81
|
+
],
|
69
82
|
```
|
70
83
|
|
84
|
+
* ファイル名にマッチする引数(e.g. ```README```)や
|
85
|
+
数字にマッチする引数(e.g. ```8```)が指定されると1行目の記述にマッチすることになる
|
86
|
+
* ワンライナーでは難しい場合は [```exe```](https://github.com/masui/GitHelp/tree/master/exe) の下にヘルパーコマンドを用意する (e.g. [```exe/githelp-changed```](https://github.com/masui/GitHelp/tree/master/exe/githelp-changed) )
|
87
|
+
|
88
|
+
### 解説
|
89
|
+
|
90
|
+
* ExpandHelp方式とは、
|
91
|
+
様々なタスクの説明と実際の操作を組にして記述しておき、
|
92
|
+
ユーザが与えたキーワードやパラメタにマッチするものを
|
93
|
+
リストして実行可能にするというものである。
|
94
|
+
* いろんなクエリに対応できるようにするため説明は正規表現で記述しておく。
|
95
|
+
たとえばシステムの時刻をセットする機能の説明は```(時計|時刻|時間)を((設定|セット)する|あわせる)```
|
96
|
+
のような正規表現で記述しておくことにより、```時刻をセットする``` ```時間をあわせる```
|
97
|
+
などのクエリにマッチするようにする。
|
98
|
+
* 「README.mdを消す方法」はマニュアルには書いてない。
|
99
|
+
「ファイルを消す方法」しか書いてない。
|
100
|
+
ファイルを消す方法を知った後で「README.md」を指定して実行する必要がある。
|
101
|
+
* そういえば先日「らくらくホン」画面上の鬱陶しい「羊」を消す方法が全くわからなかったのだが、あれは「マチキャラ」と呼ばれるものなので「マチキャラ」を消すという操作が必要だった。「羊 消す」とか「消す」とかで消せるべきだろう。githelpでは ```$ githelp 削除``` と入力すれば削除関連で何ができるのかわかる。
|
102
|
+
* ヘルプといえば人工知能的なアプローチの方がトレンドかもしれないが、
|
103
|
+
本方式だと
|
104
|
+
自分が何をやりたいのかはっきりわかってない場合でも使えるし、
|
105
|
+
正しいセンテンスを正確に入力したり発声したりする必要がないから楽だと思う。
|
106
|
+
予測入力に近いといえるかもしれない。
|
107
|
+
* **Gitは単なる適用例であり、広い範囲で使いたいと思っている。**
|
108
|
+
|
109
|
+
|
71
110
|
### お願い
|
72
111
|
|
73
|
-
|
112
|
+
* [データ](https://github.com/masui/GitHelp/tree/master/data)が全然足りないので、足すべきデータを教えて下さい。
|
113
|
+
issueでもプルリクでも@masuiへのツイートでもいいです。
|
114
|
+
|
115
|
+
### 注意
|
116
|
+
|
117
|
+
* Gitリポジトリのディレクトリで実行して下さい
|
118
|
+
* [re_expand](https://github.com/masui/expand_ruby)の実装が富豪的なので大きなリポジトリだと不具合があるかもしれません
|
119
|
+
|
120
|
+
### 関連システム
|
74
121
|
|
75
|
-
|
122
|
+
* [AnyCode](http://dl.acm.org/citation.cfm?id=2814295)
|
76
123
|
|
77
|
-
*
|
78
|
-
* ```
|
79
|
-
* もちろんこのやり方はGit以外でも有効である
|
124
|
+
* 自然言語キーワードからJavaスニペットを検索する
|
125
|
+
* ```copy fileA fileB``` みたいなキーワードから ```FileUtil.copyFile(new File(fileA), new File(fileB))``` みたいなコード候補を生成する
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "githelp"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/data/cat-file.rb
CHANGED
data/data/checkout.rb
CHANGED
data/exe/githelp
CHANGED
@@ -10,8 +10,8 @@
|
|
10
10
|
|
11
11
|
# 追加すべきデータはdata.txtに書く
|
12
12
|
|
13
|
-
require "bundler/setup"
|
14
13
|
require "githelp"
|
14
|
+
require "bundler/setup"
|
15
15
|
|
16
16
|
include Githelp
|
17
17
|
|
@@ -51,6 +51,7 @@ ARGV.dup.each { |arg|
|
|
51
51
|
list = githelp(" #{args.join(' ')} ")
|
52
52
|
if opt_x then
|
53
53
|
cmd = list[opt_x][1]
|
54
|
+
STDERR.puts cmd
|
54
55
|
system "PATH=$PATH:#{progdir}/bin; (#{cmd})"
|
55
56
|
exit
|
56
57
|
else
|
@@ -70,7 +71,7 @@ if opt_i then
|
|
70
71
|
i = s.to_i
|
71
72
|
if i >= 0 && i < list.length then
|
72
73
|
cmd = list[i][1]
|
73
|
-
puts cmd
|
74
|
+
STDERR.puts cmd
|
74
75
|
system "PATH=$PATH:#{progdir}/bin; (#{cmd})"
|
75
76
|
end
|
76
77
|
end
|
data/lib/githelp/version.rb
CHANGED
data/lib/githelp.rb
CHANGED
@@ -48,45 +48,4 @@ module Githelp
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
-
# require 're_expand'
|
52
|
-
#
|
53
|
-
# $libdir = File.dirname(__FILE__)
|
54
|
-
# require "#{$libdir}/files"
|
55
|
-
# require "#{$libdir}/args"
|
56
|
-
# require "#{$libdir}/params"
|
57
|
-
# require "#{$libdir}/patterns"
|
58
|
-
# require "#{$libdir}/tags"
|
59
|
-
# require "#{$libdir}/numbers"
|
60
|
-
# require "#{$libdir}/branches"
|
61
|
-
# require "#{$libdir}/changes"
|
62
|
-
# require "#{$libdir}/glossary"
|
63
|
-
#
|
64
|
-
# #
|
65
|
-
# # パタンを指定してコマンド候補リストを得る
|
66
|
-
# #
|
67
|
-
# def githelp(pat)
|
68
|
-
# datadir = "#{$libdir}/../data"
|
69
|
-
#
|
70
|
-
# entries = []
|
71
|
-
# Dir.open(datadir).each { |file|
|
72
|
-
# next unless File.file?("#{datadir}/#{file}")
|
73
|
-
# next if file !~ /\.rb$/
|
74
|
-
# a = eval File.read("#{datadir}/#{file}")
|
75
|
-
# entries += a if a
|
76
|
-
# }
|
77
|
-
#
|
78
|
-
# g = ExpandRuby::Generator.new # re_expandのジェネレータ
|
79
|
-
# entries.each { |entry|
|
80
|
-
# g.add entry[0], entry[1] if entry
|
81
|
-
# }
|
82
|
-
# res = g.generate pat
|
83
|
-
# listed = {}
|
84
|
-
# res[0].find_all { |a| # 0 ambig
|
85
|
-
# if listed[a[1]]
|
86
|
-
# false
|
87
|
-
# else
|
88
|
-
# listed[a[1]] = true
|
89
|
-
# end
|
90
|
-
# }
|
91
|
-
# end
|
92
51
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: githelp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Toshiyuki Masui
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -80,10 +80,10 @@ files:
|
|
80
80
|
- ".gitignore"
|
81
81
|
- Gemfile
|
82
82
|
- LICENSE.txt
|
83
|
-
- Makefile
|
84
|
-
- README-gem.md
|
85
83
|
- README.md
|
86
84
|
- Rakefile
|
85
|
+
- bin/console
|
86
|
+
- bin/setup
|
87
87
|
- data.txt
|
88
88
|
- data/adddelete.rb
|
89
89
|
- data/afteradd.rb
|
data/Makefile
DELETED
data/README-gem.md
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
# Githelp
|
2
|
-
|
3
|
-
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/githelp`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
6
|
-
|
7
|
-
## Installation
|
8
|
-
|
9
|
-
Add this line to your application's Gemfile:
|
10
|
-
|
11
|
-
```ruby
|
12
|
-
gem 'githelp'
|
13
|
-
```
|
14
|
-
|
15
|
-
And then execute:
|
16
|
-
|
17
|
-
$ bundle
|
18
|
-
|
19
|
-
Or install it yourself as:
|
20
|
-
|
21
|
-
$ gem install githelp
|
22
|
-
|
23
|
-
## Usage
|
24
|
-
|
25
|
-
TODO: Write usage instructions here
|
26
|
-
|
27
|
-
## Development
|
28
|
-
|
29
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
-
|
31
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
-
|
33
|
-
## Contributing
|
34
|
-
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/githelp.
|
36
|
-
|
37
|
-
|
38
|
-
## License
|
39
|
-
|
40
|
-
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
41
|
-
|