my_help 0.6.2 → 0.7.0
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 -1
- data/.ruby-version +1 -1
- data/Gemfile +0 -3
- data/Gemfile.lock +10 -9
- data/README.html +362 -0
- data/README.org +58 -157
- data/README.rdoc +6 -0
- data/README_en.org +131 -0
- data/Rakefile_gli +44 -0
- data/bin/my_help +67 -0
- data/lib/my_help.rb +5 -204
- data/lib/my_help/my_help_controll.rb +139 -0
- data/lib/my_help/org2yml.rb +8 -2
- data/lib/my_help/version.rb +1 -1
- data/lib/templates/org_help.org +18 -15
- data/my_help.gemspec +23 -33
- data/my_help.rdoc +5 -0
- metadata +85 -55
- data/Dockerfile.template +0 -13
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/docs/README_en.org +0 -164
- data/docs/diff_against_org_mode.org +0 -38
- data/docs/path_setting.org +0 -47
- data/exe/e_h +0 -4
- data/exe/emacs_help +0 -4
- data/exe/m_t +0 -4
- data/exe/my_help +0 -6
- data/exe/my_todo +0 -4
- data/exe/o_h +0 -4
- data/exe/org_help +0 -4
- data/lib/emacs_help.rb +0 -137
- data/lib/my_help/test.rb +0 -29
- data/lib/my_help/yml2org.rb +0 -34
- data/lib/my_help_thor.rb +0 -170
- data/lib/specific_help.rb +0 -171
- data/lib/specific_help_bu.rb +0 -233
- data/lib/specific_help_opt.rb +0 -71
- data/lib/specific_help_thor.rb +0 -172
- data/make_docker.sh +0 -5
data/README.org
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
#+TITLE: my_help README
|
2
|
+
#+AUTHOR: Shigeto R. Nishitani
|
3
|
+
#+EMAIL: (concat "nishitani@kwansei.ac.jp")
|
4
|
+
#+LANGUAGE: jp
|
5
|
+
#+OPTIONS: H:4 toc:t num:2
|
6
|
+
#+SETUPFILE: /Users/bob/Github/org-html-themes/setup/theme-readtheorg.setup
|
1
7
|
#+STARTUP: indent nolineimages
|
2
8
|
#+OPTIONS: ^:{}
|
3
9
|
|
@@ -8,6 +14,7 @@
|
|
8
14
|
|
9
15
|
CUI(CLA)ヘルプのUsage出力を真似て,user独自のhelpを作成・提供するgem.
|
10
16
|
|
17
|
+
|
11
18
|
* (my_helpで解決しようとする)問題点
|
12
19
|
:PROPERTIES:
|
13
20
|
:CUSTOM_ID: my_helpで解決しようとする問題点
|
@@ -50,14 +57,43 @@ RPGでレベル上げとかアイテムを貯めるようにして,
|
|
50
57
|
** インストール
|
51
58
|
|
52
59
|
: $ gem install my_help
|
53
|
-
です.
|
60
|
+
です.
|
54
61
|
|
55
62
|
** 簡単な使用法
|
56
63
|
:PROPERTIES:
|
57
64
|
:CUSTOM_ID: 簡単な使用法
|
58
65
|
:END:
|
59
66
|
|
60
|
-
|
67
|
+
まずは,
|
68
|
+
#+begin_example
|
69
|
+
> my_help
|
70
|
+
NAME
|
71
|
+
my_help - make own help and list.
|
72
|
+
|
73
|
+
SYNOPSIS
|
74
|
+
my_help [global options] command [command options] [arguments...]
|
75
|
+
|
76
|
+
VERSION
|
77
|
+
0.7.0
|
78
|
+
|
79
|
+
GLOBAL OPTIONS
|
80
|
+
--help - Show this message
|
81
|
+
--version - Display the program version
|
82
|
+
|
83
|
+
COMMANDS
|
84
|
+
delete - delete HELP_NAME help
|
85
|
+
edit - edit HELP_NAME help
|
86
|
+
help - Shows a list of commands or help for one command
|
87
|
+
list - list all helps, specific HELP, or item
|
88
|
+
new - make new HELP_NAME
|
89
|
+
#+end_example
|
90
|
+
としてください.このlistにargsやitemを加えて行くとわかると思います.
|
91
|
+
|
92
|
+
: my_help list
|
93
|
+
: my_help list emacs_help
|
94
|
+
: my_help list emacs_help -f
|
95
|
+
: my_help list emacs_help file
|
96
|
+
として動かしてみてください.
|
61
97
|
|
62
98
|
|
63
99
|
#+BEGIN_EXAMPLE
|
@@ -67,82 +103,22 @@ emacs_helpを動かしてみてください.
|
|
67
103
|
- C-f, controlキーを押しながら 'f'
|
68
104
|
- M-f, escキーを押した後一度離して'f'
|
69
105
|
- 操作の中断C-g, 操作の取り消し(Undo) C-x u
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
-d, --dired dired
|
85
|
-
--edit edit help contents
|
86
|
-
--all display all helps
|
87
|
-
--store [item] store [item] in backfile
|
88
|
-
--remove [item] remove [item] and store in backfile
|
89
|
-
--add [item] add new [item]
|
90
|
-
--backup_list [val] show last [val] backup list
|
91
|
-
#+END_EXAMPLE
|
92
|
-
|
93
|
-
#+BEGIN_EXAMPLE
|
94
|
-
Usage: my_help [options]
|
95
|
-
-v, --version show program Version.
|
96
|
-
-l, --list 個別(specific)ヘルプのList表示.
|
97
|
-
-e, --edit NAME NAME(例:test_help)をEdit編集.
|
98
|
-
-i, --init NAME NAME(例:test_help)のtemplateを作成.
|
99
|
-
-m, --make make executables for all helps.
|
100
|
-
-c, --clean clean up exe dir.
|
101
|
-
--install_local install local after edit helps
|
102
|
-
--delete NAME delete NAME help
|
103
|
-
#+END_EXAMPLE
|
104
|
-
|
105
|
-
です.まず,-lでdefaultで入っているリストを見てください.
|
106
|
-
--addとか--editとかで,要素の追加や編集ができます.
|
107
|
-
|
108
|
-
** alpine linuxのためのDockerfile
|
109
|
-
:PROPERTIES:
|
110
|
-
:CUSTOM_ID: alpine-linuxのためのdockerfile
|
111
|
-
:END:
|
112
|
-
|
113
|
-
my_helpをalpine
|
114
|
-
linux上で動作させるため、以下のDockerfileを作成しました。
|
115
|
-
|
116
|
-
#+BEGIN_EXAMPLE
|
117
|
-
FROM alpine:3.7
|
118
|
-
|
119
|
-
ENV http_proxy <YOUR PROXY HERE>
|
120
|
-
ENV https_proxy <YOUR PROXY HERE>
|
121
|
-
|
122
|
-
RUN apk update && apk upgrade
|
123
|
-
RUN apk --update add \
|
124
|
-
openssh git build-base libffi libffi-dev \
|
125
|
-
ruby ruby-dev ruby-rake ruby-bundler
|
126
|
-
|
127
|
-
RUN git clone https://github.com/daddygongon/my_help.git
|
128
|
-
WORKDIR my_help
|
129
|
-
|
130
|
-
RUN bundle update
|
131
|
-
RUN bundle exec exe/my_help -m && rake install:local
|
106
|
+
, head : head
|
107
|
+
, license : license
|
108
|
+
-c, cursor : cursor
|
109
|
+
-e, edit : edit
|
110
|
+
-s, short_cut : short_cut
|
111
|
+
-f, file : file
|
112
|
+
-q, quit : quit
|
113
|
+
-p, page : page
|
114
|
+
-w, window : window
|
115
|
+
-b, buffer : buffer
|
116
|
+
-m, mode : mode
|
117
|
+
, query_replace : query_replace
|
118
|
+
-r, ruby-mode : ruby-mode
|
119
|
+
-d, dired : ファイラとして使う
|
132
120
|
#+END_EXAMPLE
|
133
121
|
|
134
|
-
プロキシは適宜書き換えてください。
|
135
|
-
ビルド時のアカウントに関するエラーを除けば大体は問題なく動作しています。
|
136
|
-
|
137
|
-
#+BEGIN_SRC sh
|
138
|
-
# build an image named 'my-help'
|
139
|
-
$ docker build -t my-help .
|
140
|
-
...
|
141
|
-
|
142
|
-
# run a container
|
143
|
-
$ docker run -it --rm my-help:latest emacs_help
|
144
|
-
#+END_SRC
|
145
|
-
|
146
122
|
** 独自のhelpを作る方法
|
147
123
|
:PROPERTIES:
|
148
124
|
:CUSTOM_ID: 独自のhelpを作る方法
|
@@ -150,87 +126,12 @@ linux上で動作させるため、以下のDockerfileを作成しました。
|
|
150
126
|
|
151
127
|
さて,独自のhelpを作る方法です.まずは,
|
152
128
|
|
153
|
-
: my_help
|
154
|
-
|
155
|
-
で,new_helpというtemplateが用意されます.-e
|
156
|
-
new_helpで編集してください. emacs org形式で,格納されています.サンプルが,
|
157
|
-
|
158
|
-
にあります.このあと,-mすると自動でnew_helpがexeディレクトリーに追加されます.
|
159
|
-
|
160
|
-
* userの独自helpの達成方法
|
161
|
-
:PROPERTIES:
|
162
|
-
:CUSTOM_ID: userの独自helpの達成方法
|
163
|
-
:END:
|
164
|
-
|
165
|
-
exe中のファイルをrakeで自動生成. @target_dirにそれらのdataを保存.
|
166
|
-
その名前からexe中に実行ファイルを自動生成させている.
|
167
|
-
|
168
|
-
#+BEGIN_EXAMPLE
|
169
|
-
lib/daddygongon/
|
170
|
-
└── emacs_help
|
171
|
-
|
172
|
-
exe
|
173
|
-
├── e_h
|
174
|
-
└── emacs_help
|
175
|
-
#+END_EXAMPLE
|
176
|
-
|
177
|
-
ということ.これは,
|
178
|
-
|
179
|
-
: my_help -m
|
180
|
-
で実行される.
|
129
|
+
: my_help new new_help
|
181
130
|
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
でそのdirをcleanにしておくことが望ましい.下のuninstallの項目を参照.
|
187
|
-
|
188
|
-
* uninstall
|
189
|
-
:PROPERTIES:
|
190
|
-
:CUSTOM_ID: uninstall
|
191
|
-
:END:
|
131
|
+
で,new_helpというtemplateが用意されます.
|
132
|
+
: my_help edit new_help
|
133
|
+
で編集してください. emacs org形式で,格納されています.
|
192
134
|
|
193
|
-
my_help
|
194
|
-
filesが自動で追加される. ~/.my_helpを手で修正したときには,あらかじめ
|
195
|
-
|
196
|
-
: unistall my_help
|
197
|
-
|
198
|
-
でそれらをuninstallしておくと良い.
|
199
|
-
|
200
|
-
#+BEGIN_QUOTE
|
201
|
-
$ gem uninstall my_help
|
202
|
-
|
203
|
-
Select gem to uninstall:
|
204
|
-
1. my_help-0.1.0
|
205
|
-
2. my_help-0.2.0
|
206
|
-
3. my_help-0.2.1
|
207
|
-
4. my_help-0.2.2
|
208
|
-
5. my_help-0.2.3
|
209
|
-
6. my_help-0.3.0
|
210
|
-
7. my_help-0.3.1
|
211
|
-
8. my_help-0.3.2
|
212
|
-
9. All versions
|
213
|
-
|
214
|
-
> 9
|
215
|
-
Successfully uninstalled my_help-0.1.0 Successfully
|
216
|
-
uninstalled my_help-0.2.0 Remove executables: #my_help#
|
217
|
-
|
218
|
-
in addition to the gem? [Yn] Y
|
219
|
-
Removing #my_help# Successfully
|
220
|
-
uninstalled my_help-0.2.1 Successfully uninstalled my_help-0.2.2
|
221
|
-
Successfully uninstalled my_help-0.2.3 Successfully uninstalled
|
222
|
-
my_help-0.3.0 Remove executables: test_help
|
223
|
-
|
224
|
-
in addition to the gem? [Yn] Y
|
225
|
-
Removing test_help Successfully
|
226
|
-
uninstalled my_help-0.3.1 Remove executables: e_h, emacs_help, m_h,
|
227
|
-
member_help, my_help, n_h, new_help, r_h, ruby_help, t_h,
|
228
|
-
template_help
|
229
|
-
|
230
|
-
in addition to the gem? [Yn] Y
|
231
|
-
Removing e_h Removing emacs_help
|
232
|
-
Removing m_h Removing member_help Removing my_help Removing n_h
|
233
|
-
Removing new_help Removing r_h Removing ruby_help Removing t_h
|
234
|
-
Removing template_help Successfully uninstalled my_help-0.3.2 ```
|
235
|
-
#+END_QUOTE
|
135
|
+
: my_help delete new_help
|
236
136
|
|
137
|
+
すると消されます.
|
data/README.rdoc
ADDED
data/README_en.org
ADDED
@@ -0,0 +1,131 @@
|
|
1
|
+
* Name
|
2
|
+
:PROPERTIES:
|
3
|
+
:CUSTOM_ID: name
|
4
|
+
:END:
|
5
|
+
|
6
|
+
my\_help
|
7
|
+
|
8
|
+
* Summary
|
9
|
+
:PROPERTIES:
|
10
|
+
:CUSTOM_ID: summary
|
11
|
+
:END:
|
12
|
+
|
13
|
+
This gem makes and supplies user specific helps, emulating CUI(CLI) help
|
14
|
+
usage.
|
15
|
+
|
16
|
+
* Target
|
17
|
+
:PROPERTIES:
|
18
|
+
:CUSTOM_ID: target
|
19
|
+
:END:
|
20
|
+
|
21
|
+
A very novice of learning some specific operation, such as CUI, shell,
|
22
|
+
or emacs, has difficulty in remembering commands and grammers. If he has
|
23
|
+
a key, he can easily remember all, but no key brings nothing. Especially
|
24
|
+
a non-English-native has strong difficulty on the key rememebering. The
|
25
|
+
problems are,
|
26
|
+
|
27
|
+
- man(ual) is English
|
28
|
+
- man is heavily documented
|
29
|
+
- On web, search the same key word,
|
30
|
+
- and read the same URI repeatedly
|
31
|
+
- memo goes away somewhere...
|
32
|
+
|
33
|
+
* Specs
|
34
|
+
:PROPERTIES:
|
35
|
+
:CUSTOM_ID: specs
|
36
|
+
:END:
|
37
|
+
|
38
|
+
This gem aims to supply own help by gem environment. Specs are, - user
|
39
|
+
makes his own help - supplies a template - same format, looks,
|
40
|
+
operation, and hierarchy - easily see, read - supplies editing and
|
41
|
+
install commands.
|
42
|
+
|
43
|
+
Wiki targets the whole engineer, my\_help target the specific person.
|
44
|
+
Half of the wiki aim should be covered by my\_help. Making own manual is
|
45
|
+
one of the best practices for remembering operations. Memo applications
|
46
|
+
are good, if you remember the key word. my\_help supplies the key for
|
47
|
+
remembering the word.
|
48
|
+
|
49
|
+
* Usage
|
50
|
+
:PROPERTIES:
|
51
|
+
:CUSTOM_ID: 使用法
|
52
|
+
:END:
|
53
|
+
** Install
|
54
|
+
|
55
|
+
: $ gem install my_help
|
56
|
+
|
57
|
+
** Simple Usage
|
58
|
+
:PROPERTIES:
|
59
|
+
:CUSTOM_ID: 簡単な使用法
|
60
|
+
:END:
|
61
|
+
|
62
|
+
At first, you can see the commands supplied by my_help.
|
63
|
+
#+begin_example
|
64
|
+
> my_help
|
65
|
+
NAME
|
66
|
+
my_help - make own help and list.
|
67
|
+
|
68
|
+
SYNOPSIS
|
69
|
+
my_help [global options] command [command options] [arguments...]
|
70
|
+
|
71
|
+
VERSION
|
72
|
+
0.7.0
|
73
|
+
|
74
|
+
GLOBAL OPTIONS
|
75
|
+
--help - Show this message
|
76
|
+
--version - Display the program version
|
77
|
+
|
78
|
+
COMMANDS
|
79
|
+
delete - delete HELP_NAME help
|
80
|
+
edit - edit HELP_NAME help
|
81
|
+
help - Shows a list of commands or help for one command
|
82
|
+
list - list all helps, specific HELP, or item
|
83
|
+
new - make new HELP_NAME
|
84
|
+
#+end_example
|
85
|
+
|
86
|
+
When you add HELP_NAME and item (-o)wo'
|
87
|
+
|
88
|
+
: my_help list
|
89
|
+
: my_help list emacs_help
|
90
|
+
: my_help list emacs_help -f
|
91
|
+
: my_help list emacs_help file
|
92
|
+
|
93
|
+
|
94
|
+
#+BEGIN_EXAMPLE
|
95
|
+
- emacsのキーバインド
|
96
|
+
-
|
97
|
+
特殊キー操作
|
98
|
+
- C-f, controlキーを押しながら 'f'
|
99
|
+
- M-f, escキーを押した後一度離して'f'
|
100
|
+
- 操作の中断C-g, 操作の取り消し(Undo) C-x u
|
101
|
+
, head : head
|
102
|
+
, license : license
|
103
|
+
-c, cursor : cursor
|
104
|
+
-e, edit : edit
|
105
|
+
-s, short_cut : short_cut
|
106
|
+
-f, file : file
|
107
|
+
-q, quit : quit
|
108
|
+
-p, page : page
|
109
|
+
-w, window : window
|
110
|
+
-b, buffer : buffer
|
111
|
+
-m, mode : mode
|
112
|
+
, query_replace : query_replace
|
113
|
+
-r, ruby-mode : ruby-mode
|
114
|
+
-d, dired : ファイラとして使う
|
115
|
+
#+END_EXAMPLE
|
116
|
+
|
117
|
+
** Make your own help
|
118
|
+
:PROPERTIES:
|
119
|
+
:CUSTOM_ID: 独自のhelpを作る方法
|
120
|
+
:END:
|
121
|
+
|
122
|
+
For making your new help, you can do tha as follows:
|
123
|
+
: my_help new new_help
|
124
|
+
|
125
|
+
A templeate is compied, then you can edit as
|
126
|
+
: my_help edit new_help
|
127
|
+
The file is stored in emacs org mode.
|
128
|
+
|
129
|
+
You can delete if as follows:
|
130
|
+
: my_help delete new_help
|
131
|
+
|
data/Rakefile_gli
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'rake/clean'
|
2
|
+
require 'rubygems'
|
3
|
+
require 'rubygems/package_task'
|
4
|
+
require 'rdoc/task'
|
5
|
+
require 'cucumber'
|
6
|
+
require 'cucumber/rake/task'
|
7
|
+
Rake::RDocTask.new do |rd|
|
8
|
+
rd.main = "README.rdoc"
|
9
|
+
rd.rdoc_files.include("README.rdoc","lib/**/*.rb","bin/**/*")
|
10
|
+
rd.title = 'Your application title'
|
11
|
+
end
|
12
|
+
|
13
|
+
spec = eval(File.read('my_help.gemspec'))
|
14
|
+
|
15
|
+
Gem::PackageTask.new(spec) do |pkg|
|
16
|
+
end
|
17
|
+
CUKE_RESULTS = 'results.html'
|
18
|
+
CLEAN << CUKE_RESULTS
|
19
|
+
desc 'Run features'
|
20
|
+
Cucumber::Rake::Task.new(:features) do |t|
|
21
|
+
opts = "features --format html -o #{CUKE_RESULTS} --format progress -x"
|
22
|
+
opts += " --tags #{ENV['TAGS']}" if ENV['TAGS']
|
23
|
+
t.cucumber_opts = opts
|
24
|
+
t.fork = false
|
25
|
+
end
|
26
|
+
|
27
|
+
desc 'Run features tagged as work-in-progress (@wip)'
|
28
|
+
Cucumber::Rake::Task.new('features:wip') do |t|
|
29
|
+
tag_opts = ' --tags ~@pending'
|
30
|
+
tag_opts = ' --tags @wip'
|
31
|
+
t.cucumber_opts = "features --format html -o #{CUKE_RESULTS} --format pretty -x -s#{tag_opts}"
|
32
|
+
t.fork = false
|
33
|
+
end
|
34
|
+
|
35
|
+
task :cucumber => :features
|
36
|
+
task 'cucumber:wip' => 'features:wip'
|
37
|
+
task :wip => 'features:wip'
|
38
|
+
require 'rake/testtask'
|
39
|
+
Rake::TestTask.new do |t|
|
40
|
+
t.libs << "test"
|
41
|
+
t.test_files = FileList['test/*_test.rb']
|
42
|
+
end
|
43
|
+
|
44
|
+
task :default => [:test,:features]
|
data/bin/my_help
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'gli'
|
3
|
+
require 'my_help'
|
4
|
+
|
5
|
+
include GLI::App
|
6
|
+
|
7
|
+
program_desc 'make own help and list.'
|
8
|
+
|
9
|
+
version MyHelp::VERSION
|
10
|
+
|
11
|
+
subcommand_option_handling :normal
|
12
|
+
arguments :strict
|
13
|
+
|
14
|
+
desc 'list all helps, specific HELP, or item'
|
15
|
+
arg_name 'HELP_NAME, ITEM'
|
16
|
+
command :list do |c|
|
17
|
+
c.action do |global_options,options,args|
|
18
|
+
p args
|
19
|
+
file, item = args
|
20
|
+
if file.nil?
|
21
|
+
$control.list_all
|
22
|
+
elsif item.nil?
|
23
|
+
$control.list_help(file)
|
24
|
+
else
|
25
|
+
$control.show_item(file, item)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
desc 'edit HELP_NAME help'
|
31
|
+
arg_name 'HELP_NAME'
|
32
|
+
command :edit do |c|
|
33
|
+
c.action do |global_options,options,args|
|
34
|
+
p args
|
35
|
+
$control.edit_help(args[0])
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
desc 'make new HELP_NAME help'
|
40
|
+
arg_name 'HELP_NAME'
|
41
|
+
command :new do |c|
|
42
|
+
c.action do |global_options,options,args|
|
43
|
+
$control.init_help(args[0])
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
desc 'delete HELP_NAME help'
|
48
|
+
arg_name 'HELP_NAME'
|
49
|
+
command :delete do |c|
|
50
|
+
c.action do |global_options,options,args|
|
51
|
+
$control.delete_help(args[0])
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
pre do |global,command,options,args|
|
56
|
+
$control = MyHelp::Control.new()
|
57
|
+
true
|
58
|
+
end
|
59
|
+
|
60
|
+
post do |global,command,options,args|
|
61
|
+
end
|
62
|
+
|
63
|
+
on_error do |exception|
|
64
|
+
true
|
65
|
+
end
|
66
|
+
|
67
|
+
exit run(ARGV)
|