my_help 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +4 -3
- data/exe/e_h +1 -1
- data/exe/emacs_help +1 -1
- data/exe/my_help +0 -0
- data/lib/daddygongon/emacs_help +100 -0
- data/lib/emacs_help.rb +14 -80
- data/lib/my_help/version.rb +1 -1
- data/lib/my_help.rb +55 -1
- data/my_help.gemspec +2 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c300a6cf8118a5de14ad9a499ae09097da533f87
|
4
|
+
data.tar.gz: 213c929710cf37f80acf50a27a51a6932b5ce83f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8cf6f08dade31756b7155ed9eff41114b7aa868a8e9fe6725b7452835a8766c25e7ce8294ff5ff939080c521480a0f73ba44818ea2ff0f74fd2b8ea51feab696
|
7
|
+
data.tar.gz: 18daf94f375d54a5b10e956991248ac8bce6afda0a0071246e1d7cc988050b2e0f51b98a375bf06f0ec10e22f4cfb41fe450d35c370e0eabc1d8024a35025d08
|
data/Rakefile
CHANGED
@@ -59,13 +59,14 @@ task :my_help do
|
|
59
59
|
p file
|
60
60
|
p file_name=file.split('_')
|
61
61
|
target_files = [file, file_name[0][0]+"_"+file_name[1][0]]
|
62
|
-
p cont_name = File.join(user_name,file)
|
63
|
-
# exe_cont << "require '#{cont_name}'\n"
|
62
|
+
p cont_name = File.join('lib',user_name,file)
|
64
63
|
exe_cont << "require 'my_help'\n"
|
65
|
-
exe_cont << "
|
64
|
+
exe_cont << "MyHelp::Command.run('#{cont_name}', ARGV)\n"
|
66
65
|
target_files.each{|name|
|
66
|
+
p ''
|
67
67
|
p target=File.join('exe',name)
|
68
68
|
File.open(target,'w'){|file|
|
69
|
+
print exe_cont
|
69
70
|
file.print exe_cont
|
70
71
|
}
|
71
72
|
FileUtils.chmod('a+x', target, :verbose => true)
|
data/exe/e_h
CHANGED
data/exe/emacs_help
CHANGED
data/exe/my_help
CHANGED
File without changes
|
data/lib/daddygongon/emacs_help
CHANGED
@@ -0,0 +1,100 @@
|
|
1
|
+
---
|
2
|
+
:head:
|
3
|
+
- "\n 特殊キー操作\n"
|
4
|
+
- "\tc-f, controlキーを押しながら 'f'\n"
|
5
|
+
- "\t\tM-f, escキーを押した後一度離して'f'\n"
|
6
|
+
- "\t操作の中断c-g, 操作の取り消し(Undo) c-x u \n"
|
7
|
+
:cursor:
|
8
|
+
:opts:
|
9
|
+
:short: "-c"
|
10
|
+
:long: "--cursor"
|
11
|
+
:desc: Cursor移動
|
12
|
+
:title: |2-
|
13
|
+
|
14
|
+
カーソル移動cursor
|
15
|
+
:cont:
|
16
|
+
- c-f, move Forwrard, 前or右へ
|
17
|
+
- c-b, move Backwrard, 後or左へ
|
18
|
+
- c-a, go Ahead of line, 行頭へ
|
19
|
+
- c-e, go End of line, 行末へ
|
20
|
+
- c-n, move Next line, 次行へ
|
21
|
+
- c-p, move Previous line, 前行へ
|
22
|
+
:page:
|
23
|
+
:opts:
|
24
|
+
:short: "-p"
|
25
|
+
:long: "--ページ"
|
26
|
+
:desc: Page移動
|
27
|
+
:title: |2-
|
28
|
+
|
29
|
+
ページ移動page
|
30
|
+
:cont:
|
31
|
+
- c-v, move Vertical, 次のページへ
|
32
|
+
- M-v, move reversive Vertical,前のページへ
|
33
|
+
- c-l, centerise Line, 現在行を中心に
|
34
|
+
- M-<, move Top of file, ファイルの先頭へ
|
35
|
+
- M->, move Bottom of file, ファイルの最後尾へ
|
36
|
+
:file:
|
37
|
+
:opts:
|
38
|
+
:short: "-f"
|
39
|
+
:long: "--ファイル"
|
40
|
+
:desc: File操作
|
41
|
+
:title: |2-
|
42
|
+
|
43
|
+
ファイル操作file
|
44
|
+
:cont:
|
45
|
+
- c-x c-f, Find file, ファイルを開く
|
46
|
+
- c-x c-s, Save file, ファイルを保存
|
47
|
+
- c-x c-w, Write file NAME, ファイルを別名で書き込む
|
48
|
+
:edit:
|
49
|
+
:opts:
|
50
|
+
:short: "-e"
|
51
|
+
:long: "--編集"
|
52
|
+
:desc: Edit操作
|
53
|
+
:title: |2-
|
54
|
+
|
55
|
+
編集操作editor
|
56
|
+
:cont:
|
57
|
+
- c-d, Delete char, 一字削除
|
58
|
+
- c-k, Kill line, 一行抹消,カット
|
59
|
+
- c-y, Yank, ペースト
|
60
|
+
- c-w, Kill region, 領域抹消,カット
|
61
|
+
- "領域選択は,先頭or最後尾でc-spaceした後,最後尾or先頭へカーソル移動"
|
62
|
+
- c-s, forward incremental Search WORD, 前へWORDを検索
|
63
|
+
- c-r, Reverse incremental search WORD, 後へWORDを検索
|
64
|
+
- M-x query-replace WORD1 <ret> WORD2:対話的置換(y or nで可否選択)
|
65
|
+
:window:
|
66
|
+
:opts:
|
67
|
+
:short: "-w"
|
68
|
+
:long: "--ウィンドウ"
|
69
|
+
:desc: Window操作
|
70
|
+
:title: |2-
|
71
|
+
|
72
|
+
ウィンドウ操作window
|
73
|
+
:cont:
|
74
|
+
- c-x 2, 2 windows, 二つに分割
|
75
|
+
- c-x 1, 1 windows, 一つに戻す
|
76
|
+
- c-x 3, 3rd window sep,縦線分割
|
77
|
+
- c-x o, Other windows, 次の画面へ移動
|
78
|
+
:buffer:
|
79
|
+
:opts:
|
80
|
+
:short: "-b"
|
81
|
+
:long: "--バッファ"
|
82
|
+
:desc: Buffer操作
|
83
|
+
:title: |2-
|
84
|
+
|
85
|
+
バッファー操作buffer
|
86
|
+
:cont:
|
87
|
+
- c-x b, show Buffer, バッファのリスト
|
88
|
+
- c-x c-b, next Buffer, 次のバッファへ移動
|
89
|
+
:quit:
|
90
|
+
:opts:
|
91
|
+
:short: "-q"
|
92
|
+
:long: "--終了"
|
93
|
+
:desc: "終了操作"
|
94
|
+
:title: |2-
|
95
|
+
|
96
|
+
終了操作quit
|
97
|
+
:cont:
|
98
|
+
- c-x c-c, Quit emacs, ファイルを保存して終了
|
99
|
+
- c-z, suspend emacs, 一時停止,fgで復活
|
100
|
+
|
data/lib/emacs_help.rb
CHANGED
@@ -1,20 +1,19 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
require "optparse"
|
3
|
+
require "yaml"
|
3
4
|
require "emacs_help/version"
|
4
5
|
|
5
6
|
module EmacsHelp
|
6
7
|
class Command
|
8
|
+
|
7
9
|
def self.run(argv=[])
|
8
|
-
print "\n特殊キー操作"
|
9
|
-
print "\tc-f, controlキーを押しながら 'f'\n"
|
10
|
-
print "\t\tM-f, escキーを押した後一度離して'f'\n"
|
11
|
-
print "\t操作の中断c-g, 操作の取り消し(Undo) c-x u \n"
|
12
10
|
new(argv).execute
|
13
11
|
end
|
14
12
|
|
15
13
|
def initialize(argv=[])
|
14
|
+
@help_cont = YAML.load(File.read('lib/daddygongon/emacs_help'))
|
15
|
+
@help_cont[:head].each{|line| print line }
|
16
16
|
@argv = argv
|
17
|
-
data_path = File.join(ENV['HOME'], '.hikirc')
|
18
17
|
end
|
19
18
|
|
20
19
|
def execute
|
@@ -24,13 +23,11 @@ module EmacsHelp
|
|
24
23
|
opt.version = EmacsHelp::VERSION
|
25
24
|
puts opt.ver
|
26
25
|
}
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
opt.on('-b','--バッファ','Buffer操作') {buffer}
|
33
|
-
opt.on('-q','--終了','終了操作') {quit}
|
26
|
+
@help_cont.each_pair{|key,val|
|
27
|
+
next if key==:head
|
28
|
+
opts = val[:opts]
|
29
|
+
opt.on(opts[:short],opts[:long],opts[:desc]) {disp_from_help_cont(key)}
|
30
|
+
}
|
34
31
|
end
|
35
32
|
begin
|
36
33
|
command_parser.parse!(@argv)
|
@@ -43,80 +40,17 @@ module EmacsHelp
|
|
43
40
|
def disp(lines)
|
44
41
|
lines.each{|line|
|
45
42
|
if line.include?(',')
|
46
|
-
|
43
|
+
puts " #{line}"
|
47
44
|
else
|
48
45
|
puts " #{line}"
|
49
46
|
end
|
50
47
|
}
|
51
48
|
end
|
52
|
-
def show(line)
|
53
|
-
puts " #{line}"
|
54
|
-
end
|
55
|
-
|
56
|
-
def quit
|
57
|
-
puts "\n終了操作quit"
|
58
|
-
cont = ["c-x c-c, Quit emacs, ファイルを保存して終了",
|
59
|
-
"c-z, suspend emacs, 一時停止,fgで復活"]
|
60
|
-
disp(cont)
|
61
|
-
end
|
62
|
-
|
63
|
-
def window
|
64
|
-
puts "\nウィンドウ操作window"
|
65
|
-
cont=["c-x 2, 2 windows, 二つに分割",
|
66
|
-
"c-x 1, 1 windows, 一つに戻す",
|
67
|
-
"c-x 3, 3rd window sep,縦線分割",
|
68
|
-
"c-x o, Other windows, 次の画面へ移動"]
|
69
|
-
disp(cont)
|
70
|
-
end
|
71
|
-
|
72
|
-
def buffer
|
73
|
-
puts "\nバッファー操作buffer"
|
74
|
-
cont =[ "c-x b, show Buffer, バッファのリスト",
|
75
|
-
"c-x c-b, next Buffer, 次のバッファへ移動"]
|
76
|
-
disp(cont)
|
77
|
-
end
|
78
|
-
|
79
|
-
def edit
|
80
|
-
puts "\n編集操作editor"
|
81
|
-
cont = ["c-d, Delete char, 一字削除",
|
82
|
-
"c-k, Kill line, 一行抹消,カット",
|
83
|
-
"c-y, Yank, ペースト",
|
84
|
-
"c-w, Kill region, 領域抹消,カット",
|
85
|
-
"領域選択は,先頭or最後尾でc-spaceした後,最後尾or先頭へカーソル移動",
|
86
|
-
"c-s, forward incremental Search WORD, 前へWORDを検索",
|
87
|
-
"c-r, Reverse incremental search WORD, 後へWORDを検索",
|
88
|
-
"M-x query-replace WORD1 <ret> WORD2:対話的置換(y or nで可否選択)"]
|
89
|
-
disp(cont)
|
90
|
-
end
|
91
|
-
|
92
|
-
def file
|
93
|
-
puts "\nファイル操作file"
|
94
|
-
cont =[ "c-x c-f, Find file, ファイルを開く",
|
95
|
-
"c-x c-s, Save file, ファイルを保存",
|
96
|
-
"c-x c-w, Write file NAME, ファイルを別名で書き込む"]
|
97
|
-
disp(cont)
|
98
|
-
end
|
99
|
-
|
100
|
-
def page_move
|
101
|
-
puts "\nページ移動page"
|
102
|
-
cont = ["c-v, move Vertical, 次のページへ",
|
103
|
-
"M-v, move reversive Vertical,前のページへ",
|
104
|
-
"c-l, centerise Line, 現在行を中心に",
|
105
|
-
"M-<, move Top of file, ファイルの先頭へ",
|
106
|
-
"M->, move Bottom of file, ファイルの最後尾へ"]
|
107
|
-
disp(cont)
|
108
|
-
end
|
109
49
|
|
110
|
-
def
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
"c-a, go Ahead of line, 行頭へ",
|
115
|
-
"c-e, go End of line, 行末へ",
|
116
|
-
"c-n, move Next line, 次行へ",
|
117
|
-
"c-p, move Previous line, 前行へ"]
|
118
|
-
disp(cont)
|
50
|
+
def disp_from_help_cont(key_word)
|
51
|
+
items =@help_cont[key_word]
|
52
|
+
puts items[:title]
|
53
|
+
disp(items[:cont])
|
119
54
|
end
|
120
|
-
|
121
55
|
end
|
122
56
|
end
|
data/lib/my_help/version.rb
CHANGED
data/lib/my_help.rb
CHANGED
@@ -1,6 +1,60 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require "optparse"
|
3
|
+
require "yaml"
|
4
|
+
require "emacs_help/version"
|
1
5
|
require "my_help/version"
|
2
6
|
require "emacs_help"
|
3
7
|
|
4
8
|
module MyHelp
|
5
|
-
|
9
|
+
class Command
|
10
|
+
|
11
|
+
def self.run(file,argv=[])
|
12
|
+
new(file, argv).execute
|
13
|
+
end
|
14
|
+
|
15
|
+
def initialize(file,argv=[])
|
16
|
+
@help_cont = YAML.load(File.read(file))
|
17
|
+
# @help_cont = YAML.load(File.read('lib/daddygongon/emacs_help'))
|
18
|
+
@help_cont[:head].each{|line| print line }
|
19
|
+
@argv = argv
|
20
|
+
end
|
21
|
+
|
22
|
+
def execute
|
23
|
+
@argv << '--help' if @argv.size==0
|
24
|
+
command_parser = OptionParser.new do |opt|
|
25
|
+
opt.on('-v', '--version','show program Version.') { |v|
|
26
|
+
opt.version = EmacsHelp::VERSION
|
27
|
+
puts opt.ver
|
28
|
+
}
|
29
|
+
@help_cont.each_pair{|key,val|
|
30
|
+
next if key==:head
|
31
|
+
opts = val[:opts]
|
32
|
+
opt.on(opts[:short],opts[:long],opts[:desc]) {disp_from_help_cont(key)}
|
33
|
+
}
|
34
|
+
end
|
35
|
+
begin
|
36
|
+
command_parser.parse!(@argv)
|
37
|
+
rescue=> eval
|
38
|
+
p eval
|
39
|
+
end
|
40
|
+
exit
|
41
|
+
end
|
42
|
+
|
43
|
+
def disp(lines)
|
44
|
+
lines.each{|line|
|
45
|
+
if line.include?(',')
|
46
|
+
puts " #{line}"
|
47
|
+
else
|
48
|
+
puts " #{line}"
|
49
|
+
end
|
50
|
+
}
|
51
|
+
end
|
52
|
+
|
53
|
+
def disp_from_help_cont(key_word)
|
54
|
+
items =@help_cont[key_word]
|
55
|
+
puts items[:title]
|
56
|
+
disp(items[:cont])
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
6
60
|
end
|
data/my_help.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["shigeto_nishitani@me.com"]
|
11
11
|
|
12
12
|
spec.summary = %q{display emacs key bindings in Japanese.}
|
13
|
-
spec.description = %q{Emulating CUI(CLI) help, user
|
13
|
+
spec.description = %q{Emulating CUI(CLI) help, an user makes and displays his own helps.}
|
14
14
|
spec.homepage = "https://github.com/daddygongon/my_help"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
@@ -34,4 +34,5 @@ Gem::Specification.new do |spec|
|
|
34
34
|
spec.add_development_dependency "hiki2md"
|
35
35
|
spec.add_development_dependency "mathjax-yard"
|
36
36
|
spec.add_development_dependency "hiki2latex"
|
37
|
+
|
37
38
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: my_help
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shigeto R. Nishitani
|
@@ -108,7 +108,7 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
-
description: Emulating CUI(CLI) help, user
|
111
|
+
description: Emulating CUI(CLI) help, an user makes and displays his own helps.
|
112
112
|
email:
|
113
113
|
- shigeto_nishitani@me.com
|
114
114
|
executables:
|