my_help 0.3.2 → 0.3.3

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.
@@ -53,12 +53,13 @@ Supplied commands are
53
53
  bob% bundle exec exe/my_help
54
54
  Usage: my_help [options]
55
55
  -v, --version show program Version.
56
- -l, --list list specific help.
57
- -e, --edit NAME edit NAME(cf test_help).
58
- -i, --init NAME initialize NAME(cf, test_help) template.
59
- -m, --make make and install:local all helps.
56
+ -l, --list list specific helps
57
+ -e, --edit NAME edit NAME help(eg test_help)
58
+ -i, --init NAME initialize NAME help(eg test_help).
59
+ -m, --make make executables for all helps.
60
60
  -c, --clean clean up exe dir.
61
61
  --install_local install local after edit helps
62
+ --delete NAME delete NAME help
62
63
  ```
63
64
 
64
65
  At first, see the list of supplied helps by the option of -l.
@@ -74,6 +75,32 @@ Specific help file:
74
75
  emacs_help, e_h, test_help, t_h are ready to use.
75
76
  Play them by a command such as 'bundle exec exe/e_h'.
76
77
 
78
+ emacsのキーバインド
79
+
80
+ ```
81
+ 特殊キー操作
82
+ c-f, controlキーを押しながら 'f'
83
+ M-f, escキーを押した後一度離して'f'
84
+ 操作の中断c-g, 操作の取り消し(Undo) c-x u
85
+ cc by Shigeto R. Nishitani, 2016
86
+ Usage: e_h [options]
87
+ -v, --version show program Version.
88
+ -c, --cursor Cursor移動
89
+ -e, --編集 Edit操作
90
+ -f, --ファイル File操作
91
+ -q, --終了 終了操作
92
+ -p, --ページ Page移動
93
+ -w, --ウィンドウ Window操作
94
+ -b, --バッファ Buffer操作
95
+ -m, --mode モード切り替え
96
+ --edit edit help contents
97
+ --to_hiki convert to hikidoc format
98
+ --all display all helps
99
+ --store [item] store [item] in back
100
+ --remove [item] remove [item] in back
101
+ --add [item] add new [item]
102
+ ```
103
+
77
104
  ## Make own help
78
105
  The next step is making own help.
79
106
  For this, -i NAME supplies new NAME help.
@@ -30,6 +30,11 @@ commandや文法を覚えるのに苦労します.少しのkey(とっかかり
30
30
  hikiでやろうとしていることの半分くらいはこのあたりのことなの
31
31
  かもしれません.memoソフトでは,検索が必要となりますが,my_helpは
32
32
  key(記憶のとっかかり)を提供することが目的です.
33
+ RPGでレベル上げとかアイテムを貯めるようにして,
34
+ プログラミングでスキルを発展させてください.
35
+
36
+ 物覚えの悪い作者は,人の名前をitem分けして,こそっと使っています.
37
+
33
38
 
34
39
  # 使用法
35
40
  ## インストール
@@ -56,6 +61,7 @@ Usage: my_help [options]
56
61
  -m, --make make executables for all helps.
57
62
  -c, --clean clean up exe dir.
58
63
  --install_local install local after edit helps
64
+ --delete NAME delete NAME help
59
65
  ```
60
66
  です.まず,-lでdefaultで入っているリストを見てください.
61
67
 
@@ -65,9 +71,35 @@ bob% bundle exec exe/my_help -l
65
71
  ["-l"]
66
72
  Specific help file:
67
73
  emacs_help
68
- test_help
69
74
  ```
70
- これで,CUIでemacs_help, e_h, template_help, t_hが用意されています.少し振る舞いに慣れてください.
75
+ これで,CUIでemacs_help, e_hが用意されています.
76
+
77
+ ```
78
+ emacsのキーバインド
79
+
80
+ 特殊キー操作
81
+ c-f, controlキーを押しながら 'f'
82
+ M-f, escキーを押した後一度離して'f'
83
+ 操作の中断c-g, 操作の取り消し(Undo) c-x u
84
+ cc by Shigeto R. Nishitani, 2016
85
+ Usage: e_h [options]
86
+ -v, --version show program Version.
87
+ -c, --cursor Cursor移動
88
+ -e, --編集 Edit操作
89
+ -f, --ファイル File操作
90
+ -q, --終了 終了操作
91
+ -p, --ページ Page移動
92
+ -w, --ウィンドウ Window操作
93
+ -b, --バッファ Buffer操作
94
+ -m, --mode モード切り替え
95
+ --edit edit help contents
96
+ --to_hiki convert to hikidoc format
97
+ --all display all helps
98
+ --store [item] store [item] in back
99
+ --remove [item] remove [item] in back
100
+ --add [item] add new [item]
101
+ ```
102
+ 少し振る舞いに慣れてください.
71
103
 
72
104
  ## 独自のhelpを作る方法
73
105
  さて,独自のhelpを作る方法です.まずは,
@@ -78,7 +110,12 @@ bob% bundle exec exe/my_help -i new_help
78
110
  "/Users/bob/Github/my_help/lib/daddygongon/template_help"
79
111
  cp /Users/bob/Github/my_help/lib/daddygongon/template_help /Users/bob/.my_help/new_help
80
112
  ```
81
- で,new_helpというtemplateが用意されます.-e new_helpで編集してください.そのあと,-mすると自動でnew_helpがexeディレクトリーに追加されます.
113
+ で,new_helpというtemplateが用意されます.-e new_helpで編集してください.
114
+ YAML形式で,格納されています.サンプルが,
115
+ ```
116
+ my_help/lib/daddygongon
117
+ ```
118
+ にあります.このあと,-mすると自動でnew_helpがexeディレクトリーに追加されます.
82
119
 
83
120
  ## 独自helpを使えるように
84
121
  (これは,-mで自動的に行われるように修正されています)
@@ -98,8 +135,8 @@ cp /Users/bob/Github/my_help/lib/daddygongon/template_help /Users/bob/.my_help/n
98
135
  - @target dirをmy_help/lib/daddygongonからENV['HOME']/.my_helpに変更
99
136
 
100
137
  exe中のファイルをrakeで自動生成.
101
- @target_dirにそれらのdataを保存.以下ではその名前から
102
- exe中に実行ファイルを自動生成させている.
138
+ @target_dirにそれらのdataを保存.
139
+ その名前からexe中に実行ファイルを自動生成させている.
103
140
  ```
104
141
  lib/daddygongon/
105
142
  └── emacs_help
@@ -123,34 +160,32 @@ rake install:local
123
160
  gem uninstall my_help
124
161
  gem uninstall emacs_help
125
162
  ```
126
- でそのdirをcleanにしておくことが望ましい.
163
+ でそのdirをcleanにしておくことが望ましい.下のuninstallの項目を参照.
127
164
 
128
- 中身は以下の通り.
165
+ -mでやっている中身は以下の通り.
129
166
  ```ruby
130
- desc "make own help from lib/daddygongon/files"
131
- task :my_help do
132
- exe_cont="#!/usr/bin/env ruby\n"
133
- user_name = 'daddygongon'
134
- p entries=Dir.entries(File.join('.','lib',user_name))[2..-1]
135
- entries.each{|file|
136
- p file
137
- p file_name=file.split('_')
138
- target_files = [file, file_name[0][0]+"_"+file_name[1][0]]
139
- p cont_name = File.join('lib',user_name,file)
140
- exe_cont << "require 'my_help'\n"
141
- exe_cont << "help_file = File.expand_path(\"../../#{cont_name}\", __FILE__)\n"
142
- exe_cont << "MyHelp::Command.run(help_file, ARGV)\n"
143
- target_files.each{|name|
144
- p ''
145
- p target=File.join('exe',name)
146
- File.open(target,'w'){|file|
147
- print exe_cont
148
- file.print exe_cont
167
+ def make_help
168
+ Dir.entries(@target_dir)[2..-1].each{|file|
169
+ next if file[0]=='#' or file[-1]=='~'
170
+ exe_cont="#!/usr/bin/env ruby\nrequire 'specific_help'\n"
171
+ exe_cont << "help_file = File.join(ENV['HOME'],'.my_help','#{file}')\n"
172
+ exe_cont << "SpecificHelp::Command.run(help_file, ARGV)\n"
173
+ [file, short_name(file)].each{|name|
174
+ p target=File.join('exe',name)
175
+ File.open(target,'w'){|file| file.print exe_cont}
176
+ FileUtils.chmod('a+x', target, :verbose => true)
177
+ }
149
178
  }
150
- FileUtils.chmod('a+x', target, :verbose => true)
151
- }
152
- }
153
- end
179
+ install_local
180
+ end
181
+
182
+ def install_local
183
+ #中略
184
+ system "git add -A"
185
+ system "git commit -m 'update exe dirs'"
186
+ system "Rake install:local"
187
+ end
188
+
154
189
  ```
155
190
 
156
191
  実装方法は,emacs_helpに
@@ -162,10 +197,30 @@ end
162
197
  今の所,No.1の方を実装.No.2のためのhushデータは,
163
198
 
164
199
  ```ruby
200
+ # -*- coding: utf-8 -*-
165
201
  require 'yaml'
166
202
  require 'pp'
167
-
168
- pp YAML.load(File.read(ARGV[0]))
203
+ yaml =<<EOF
204
+ :file:
205
+ :opts:
206
+ :short: "-f"
207
+ :cont:
208
+ - c-x c-f, Find file, ファイルを開く
209
+ - c-x c-s, Save file, ファイルを保存
210
+ EOF
211
+ pp data=YAML.load(yaml)
212
+ print YAML.dump(data)
213
+
214
+
215
+ data0={:file=>
216
+ {:opts=>{:short=>"-f", :long=>"--ファイル", :desc=>"File操作"},
217
+ :title=>"ファイル操作file",
218
+ :cont=>
219
+ ["c-x c-f, Find file, ファイルを開く
220
+ c-x c-s, Save file, ファイルを保存
221
+ c-x c-w, Write file NAME, ファイルを別名で書き込む"]}}
222
+
223
+ print YAML.dump(data0)
169
224
  ```
170
225
 
171
226
  ```
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: my_help
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shigeto R. Nishitani
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-11-08 00:00:00.000000000 Z
11
+ date: 2016-11-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -126,8 +126,11 @@ description: Emulating CUI(CLI) help, an user makes and displays his own helps.
126
126
  email:
127
127
  - shigeto_nishitani@me.com
128
128
  executables:
129
+ - e_h
129
130
  - emacs_help
130
131
  - my_help
132
+ - t_h
133
+ - template_help
131
134
  extensions: []
132
135
  extra_rdoc_files: []
133
136
  files:
@@ -142,8 +145,11 @@ files:
142
145
  - Rakefile
143
146
  - bin/console
144
147
  - bin/setup
148
+ - exe/e_h
145
149
  - exe/emacs_help
146
150
  - exe/my_help
151
+ - exe/t_h
152
+ - exe/template_help
147
153
  - hikis/README_en.hiki
148
154
  - hikis/README_ja.hiki
149
155
  - hikis/emacs_help.hiki
@@ -151,7 +157,12 @@ files:
151
157
  - latexes/handout_pre.tex
152
158
  - lib/daddygongon/emacs_help
153
159
  - lib/daddygongon/template_help
160
+ - lib/emacs_help.rb
154
161
  - lib/my_help.rb
162
+ - lib/my_help.rb~
163
+ - lib/my_help/#test.rb#
164
+ - lib/my_help/.#test.rb
165
+ - lib/my_help/test.rb
155
166
  - lib/my_help/version.rb
156
167
  - lib/specific_help.rb
157
168
  - my_help.gemspec