my_help 1.2.9 → 1.2.12
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/Gemfile +1 -10
- data/Gemfile.lock +6 -64
- data/README.org +24 -0
- data/Rakefile +0 -35
- data/development_memo.org +4 -0
- data/doc/MyHelp/CLI.html +218 -74
- data/doc/MyHelp/Config.html +108 -42
- data/doc/MyHelp/Error.html +2 -2
- data/doc/MyHelp/GetConfig.html +6 -4
- data/doc/MyHelp/Git.html +8 -8
- data/doc/MyHelp/Init.html +2 -2
- data/doc/MyHelp/List.html +121 -56
- data/doc/MyHelp/Md2Hash.html +2 -2
- data/doc/MyHelp/Modify.html +2 -2
- data/doc/MyHelp/Org2Hash.html +14 -4
- data/doc/MyHelp.html +3 -3
- data/doc/Org2Yaml.html +2 -2
- data/doc/_index.html +2 -2
- data/doc/class_list.html +6 -3
- data/doc/css/full_list.css +3 -3
- data/doc/css/style.css +6 -0
- data/doc/file.README.html +2 -2
- data/doc/file_list.html +5 -2
- data/doc/index.html +2 -2
- data/doc/js/app.js +294 -264
- data/doc/js/full_list.js +30 -4
- data/doc/js/jquery.js +2 -4
- data/doc/method_list.html +63 -28
- data/doc/top-level-namespace.html +2 -2
- data/lib/my_help/cli.rb +45 -6
- data/lib/my_help/config.rb +8 -3
- data/lib/my_help/init.rb +8 -1
- data/lib/my_help/list.rb +20 -14
- data/lib/my_help/modify.rb +7 -5
- data/lib/my_help/org2hash.rb +3 -3
- data/lib/my_help/version.rb +1 -1
- data/lib/templates/kick_off.md +51 -0
- data/lib/templates/kick_off.org +57 -0
- data/my_help.gemspec +3 -3
- metadata +5 -56
- data/.DS_Store +0 -0
- data/.dockerignore +0 -2
- data/.my_help/example2.org +0 -9
- data/.rspec +0 -3
- data/.rspec_status +0 -13
- data/.travis.yml +0 -4
- data/.yardoc/checksums +0 -11
- data/.yardoc/complete +0 -0
- data/.yardoc/object_types +0 -0
- data/.yardoc/objects/root.dat +0 -0
- data/.yardoc/proxy_types +0 -0
data/doc/method_list.html
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
|
-
<html>
|
2
|
+
<html >
|
3
3
|
<head>
|
4
4
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
5
5
|
<meta charset="utf-8" />
|
@@ -38,7 +38,10 @@
|
|
38
38
|
|
39
39
|
</div>
|
40
40
|
|
41
|
-
<div id="search">
|
41
|
+
<div id="search">
|
42
|
+
<label for="search-class">Search:</label>
|
43
|
+
<input id="search-class" type="text" />
|
44
|
+
</div>
|
42
45
|
</div>
|
43
46
|
|
44
47
|
<ul id="full_list" class="method">
|
@@ -53,6 +56,14 @@
|
|
53
56
|
|
54
57
|
|
55
58
|
<li class="even ">
|
59
|
+
<div class="item">
|
60
|
+
<span class='object_link'><a href="MyHelp/CLI.html#add_defaults-instance_method" title="MyHelp::CLI#add_defaults (method)">#add_defaults</a></span>
|
61
|
+
<small>MyHelp::CLI</small>
|
62
|
+
</div>
|
63
|
+
</li>
|
64
|
+
|
65
|
+
|
66
|
+
<li class="odd ">
|
56
67
|
<div class="item">
|
57
68
|
<span class='object_link'><a href="MyHelp/Init.html#check_conf_exist-instance_method" title="MyHelp::Init#check_conf_exist (method)">#check_conf_exist</a></span>
|
58
69
|
<small>MyHelp::Init</small>
|
@@ -60,6 +71,14 @@
|
|
60
71
|
</li>
|
61
72
|
|
62
73
|
|
74
|
+
<li class="even ">
|
75
|
+
<div class="item">
|
76
|
+
<span class='object_link'><a href="MyHelp/Config.html#check_template_dir-instance_method" title="MyHelp::Config#check_template_dir (method)">#check_template_dir</a></span>
|
77
|
+
<small>MyHelp::Config</small>
|
78
|
+
</div>
|
79
|
+
</li>
|
80
|
+
|
81
|
+
|
63
82
|
<li class="odd ">
|
64
83
|
<div class="item">
|
65
84
|
<span class='object_link'><a href="MyHelp/Config.html#config-instance_method" title="MyHelp::Config#config (method)">#config</a></span>
|
@@ -86,16 +105,16 @@
|
|
86
105
|
|
87
106
|
<li class="even ">
|
88
107
|
<div class="item">
|
89
|
-
<span class='object_link'><a href="MyHelp/
|
90
|
-
<small>MyHelp::
|
108
|
+
<span class='object_link'><a href="MyHelp/Md2Hash.html#contents-instance_method" title="MyHelp::Md2Hash#contents (method)">#contents</a></span>
|
109
|
+
<small>MyHelp::Md2Hash</small>
|
91
110
|
</div>
|
92
111
|
</li>
|
93
112
|
|
94
113
|
|
95
114
|
<li class="odd ">
|
96
115
|
<div class="item">
|
97
|
-
<span class='object_link'><a href="MyHelp/
|
98
|
-
<small>MyHelp::
|
116
|
+
<span class='object_link'><a href="MyHelp/Org2Hash.html#contents-instance_method" title="MyHelp::Org2Hash#contents (method)">#contents</a></span>
|
117
|
+
<small>MyHelp::Org2Hash</small>
|
99
118
|
</div>
|
100
119
|
</li>
|
101
120
|
|
@@ -110,16 +129,16 @@
|
|
110
129
|
|
111
130
|
<li class="odd ">
|
112
131
|
<div class="item">
|
113
|
-
<span class='object_link'><a href="MyHelp/
|
114
|
-
<small>MyHelp::
|
132
|
+
<span class='object_link'><a href="MyHelp/CLI.html#delete-instance_method" title="MyHelp::CLI#delete (method)">#delete</a></span>
|
133
|
+
<small>MyHelp::CLI</small>
|
115
134
|
</div>
|
116
135
|
</li>
|
117
136
|
|
118
137
|
|
119
138
|
<li class="even ">
|
120
139
|
<div class="item">
|
121
|
-
<span class='object_link'><a href="MyHelp/
|
122
|
-
<small>MyHelp::
|
140
|
+
<span class='object_link'><a href="MyHelp/Modify.html#delete-instance_method" title="MyHelp::Modify#delete (method)">#delete</a></span>
|
141
|
+
<small>MyHelp::Modify</small>
|
123
142
|
</div>
|
124
143
|
</li>
|
125
144
|
|
@@ -206,56 +225,56 @@
|
|
206
225
|
|
207
226
|
<li class="odd ">
|
208
227
|
<div class="item">
|
209
|
-
<span class='object_link'><a href="
|
210
|
-
<small>
|
228
|
+
<span class='object_link'><a href="MyHelp/Config.html#initialize-instance_method" title="MyHelp::Config#initialize (method)">#initialize</a></span>
|
229
|
+
<small>MyHelp::Config</small>
|
211
230
|
</div>
|
212
231
|
</li>
|
213
232
|
|
214
233
|
|
215
234
|
<li class="even ">
|
216
235
|
<div class="item">
|
217
|
-
<span class='object_link'><a href="MyHelp/
|
218
|
-
<small>MyHelp::
|
236
|
+
<span class='object_link'><a href="MyHelp/List.html#initialize-instance_method" title="MyHelp::List#initialize (method)">#initialize</a></span>
|
237
|
+
<small>MyHelp::List</small>
|
219
238
|
</div>
|
220
239
|
</li>
|
221
240
|
|
222
241
|
|
223
242
|
<li class="odd ">
|
224
243
|
<div class="item">
|
225
|
-
<span class='object_link'><a href="
|
226
|
-
<small>
|
244
|
+
<span class='object_link'><a href="Org2Yaml.html#initialize-instance_method" title="Org2Yaml#initialize (method)">#initialize</a></span>
|
245
|
+
<small>Org2Yaml</small>
|
227
246
|
</div>
|
228
247
|
</li>
|
229
248
|
|
230
249
|
|
231
250
|
<li class="even ">
|
232
251
|
<div class="item">
|
233
|
-
<span class='object_link'><a href="MyHelp/
|
234
|
-
<small>MyHelp::
|
252
|
+
<span class='object_link'><a href="MyHelp/Init.html#initialize-instance_method" title="MyHelp::Init#initialize (method)">#initialize</a></span>
|
253
|
+
<small>MyHelp::Init</small>
|
235
254
|
</div>
|
236
255
|
</li>
|
237
256
|
|
238
257
|
|
239
258
|
<li class="odd ">
|
240
259
|
<div class="item">
|
241
|
-
<span class='object_link'><a href="MyHelp/
|
242
|
-
<small>MyHelp::
|
260
|
+
<span class='object_link'><a href="MyHelp/Org2Hash.html#initialize-instance_method" title="MyHelp::Org2Hash#initialize (method)">#initialize</a></span>
|
261
|
+
<small>MyHelp::Org2Hash</small>
|
243
262
|
</div>
|
244
263
|
</li>
|
245
264
|
|
246
265
|
|
247
266
|
<li class="even ">
|
248
267
|
<div class="item">
|
249
|
-
<span class='object_link'><a href="MyHelp/
|
250
|
-
<small>MyHelp::
|
268
|
+
<span class='object_link'><a href="MyHelp/Md2Hash.html#initialize-instance_method" title="MyHelp::Md2Hash#initialize (method)">#initialize</a></span>
|
269
|
+
<small>MyHelp::Md2Hash</small>
|
251
270
|
</div>
|
252
271
|
</li>
|
253
272
|
|
254
273
|
|
255
274
|
<li class="odd ">
|
256
275
|
<div class="item">
|
257
|
-
<span class='object_link'><a href="MyHelp/
|
258
|
-
<small>MyHelp::
|
276
|
+
<span class='object_link'><a href="MyHelp/Modify.html#initialize-instance_method" title="MyHelp::Modify#initialize (method)">#initialize</a></span>
|
277
|
+
<small>MyHelp::Modify</small>
|
259
278
|
</div>
|
260
279
|
</li>
|
261
280
|
|
@@ -318,16 +337,16 @@
|
|
318
337
|
|
319
338
|
<li class="odd ">
|
320
339
|
<div class="item">
|
321
|
-
<span class='object_link'><a href="MyHelp/
|
322
|
-
<small>MyHelp::
|
340
|
+
<span class='object_link'><a href="MyHelp/Modify.html#new-instance_method" title="MyHelp::Modify#new (method)">#new</a></span>
|
341
|
+
<small>MyHelp::Modify</small>
|
323
342
|
</div>
|
324
343
|
</li>
|
325
344
|
|
326
345
|
|
327
346
|
<li class="even ">
|
328
347
|
<div class="item">
|
329
|
-
<span class='object_link'><a href="MyHelp/
|
330
|
-
<small>MyHelp::
|
348
|
+
<span class='object_link'><a href="MyHelp/CLI.html#new-instance_method" title="MyHelp::CLI#new (method)">#new</a></span>
|
349
|
+
<small>MyHelp::CLI</small>
|
331
350
|
</div>
|
332
351
|
</li>
|
333
352
|
|
@@ -356,6 +375,22 @@
|
|
356
375
|
</li>
|
357
376
|
|
358
377
|
|
378
|
+
<li class="even ">
|
379
|
+
<div class="item">
|
380
|
+
<span class='object_link'><a href="MyHelp/List.html#pad_multi_bytes-instance_method" title="MyHelp::List#pad_multi_bytes (method)">#pad_multi_bytes</a></span>
|
381
|
+
<small>MyHelp::List</small>
|
382
|
+
</div>
|
383
|
+
</li>
|
384
|
+
|
385
|
+
|
386
|
+
<li class="odd ">
|
387
|
+
<div class="item">
|
388
|
+
<span class='object_link'><a href="MyHelp/CLI.html#place-instance_method" title="MyHelp::CLI#place (method)">#place</a></span>
|
389
|
+
<small>MyHelp::CLI</small>
|
390
|
+
</div>
|
391
|
+
</li>
|
392
|
+
|
393
|
+
|
359
394
|
<li class="even ">
|
360
395
|
<div class="item">
|
361
396
|
<span class='object_link'><a href="MyHelp/Git.html#pull-instance_method" title="MyHelp::Git#pull (method)">#pull</a></span>
|
@@ -102,9 +102,9 @@
|
|
102
102
|
</div>
|
103
103
|
|
104
104
|
<div id="footer">
|
105
|
-
Generated on
|
105
|
+
Generated on Tue Oct 15 12:36:20 2024 by
|
106
106
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
107
|
-
0.9.
|
107
|
+
0.9.37 (ruby-3.0.2).
|
108
108
|
</div>
|
109
109
|
|
110
110
|
</div>
|
data/lib/my_help/cli.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'colorize'
|
1
2
|
module MyHelp
|
2
3
|
class CLI < Thor
|
3
4
|
include GetConfig
|
@@ -21,6 +22,19 @@ module MyHelp
|
|
21
22
|
puts "my_help #{VERSION}"
|
22
23
|
end
|
23
24
|
|
25
|
+
map "-s" => :search
|
26
|
+
desc "search [WORD]", "search word on my_helps dir"
|
27
|
+
|
28
|
+
def search(*args)
|
29
|
+
c = get_config
|
30
|
+
word = args[0]
|
31
|
+
targets = File.join(c[:local_help_dir],"*"+c[:ext])
|
32
|
+
puts "my_help search word on my_helps dir"
|
33
|
+
comm = "grep #{word} #{targets}"
|
34
|
+
puts "#{comm}\n\n"
|
35
|
+
system comm
|
36
|
+
end
|
37
|
+
|
24
38
|
desc "git [pull|push]", "git operations"
|
25
39
|
subcommand "git", Git
|
26
40
|
|
@@ -40,7 +54,7 @@ module MyHelp
|
|
40
54
|
end
|
41
55
|
end
|
42
56
|
end
|
43
|
-
|
57
|
+
|
44
58
|
map "-i" => :init
|
45
59
|
desc "init", "initialize my_help environment"
|
46
60
|
|
@@ -49,14 +63,20 @@ module MyHelp
|
|
49
63
|
|
50
64
|
#config.ask_default
|
51
65
|
init = Init.new(config)
|
52
|
-
|
66
|
+
begin
|
67
|
+
init.help_dir_exist?
|
68
|
+
rescue RuntimeError => e
|
69
|
+
puts "RuntimeError: #{e.message}"
|
70
|
+
exit
|
71
|
+
end
|
53
72
|
puts "Choose default markup '.org' [Y or .md]? "
|
54
73
|
response = $stdin.gets.chomp
|
55
74
|
config.configure(:ext => response) unless response.upcase[0] == "Y"
|
56
75
|
init.mk_help_dir
|
57
76
|
config.save_config
|
58
77
|
init.cp_templates
|
59
|
-
puts "
|
78
|
+
puts "For changing editor to code: 'my_help set editor code'.".green
|
79
|
+
puts "For activating batcat: 'my_help set bat true'.".green
|
60
80
|
end
|
61
81
|
|
62
82
|
desc "set [:key] [VAL]", "set editor or ext"
|
@@ -64,7 +84,13 @@ module MyHelp
|
|
64
84
|
def set(*args)
|
65
85
|
config = get_config # for using methods in Config
|
66
86
|
key = args[0] || ""
|
67
|
-
|
87
|
+
begin
|
88
|
+
config.configure(key.to_sym => args[1])
|
89
|
+
rescue => e
|
90
|
+
puts e
|
91
|
+
exit
|
92
|
+
end
|
93
|
+
|
68
94
|
config.save_config
|
69
95
|
conf_file_path = config[:conf_file]
|
70
96
|
puts "conf_file_path: %s" % conf_file_path
|
@@ -80,16 +106,29 @@ module MyHelp
|
|
80
106
|
config = get_config
|
81
107
|
help_dir = options["help_dir"] || config[:local_help_dir]
|
82
108
|
layer = options["layer"] || 1
|
83
|
-
|
109
|
+
text = List.new(help_dir,
|
84
110
|
config[:ext],
|
85
111
|
layer).list(*args.join(" "))
|
112
|
+
if config[:bat]
|
113
|
+
require "tempfile"
|
114
|
+
t = Tempfile.open(['hoge', 'bar'])
|
115
|
+
File.write(t.path, text)
|
116
|
+
if ENV["WSL_DISTRO_NAME"]=="Ubuntu"
|
117
|
+
# p ['config[:bat]',config[:bat]]
|
118
|
+
system("cat #{t.path} |batcat --theme Coldark-Cold -l zsh -p") #| bat -l org -p")
|
119
|
+
else
|
120
|
+
system("cat #{t.path} |bat -l zsh -p") #| bat -l org -p")
|
121
|
+
end
|
122
|
+
else
|
123
|
+
puts text
|
124
|
+
end
|
86
125
|
end
|
87
126
|
|
88
127
|
map "-e" => :edit
|
89
128
|
desc "edit [HELP]", "edit help"
|
90
129
|
def edit(*args)
|
91
130
|
c = get_config
|
92
|
-
help_name = args[0]
|
131
|
+
help_name = *args[0] #.join(" ")
|
93
132
|
Modify.new(c).edit(help_name)
|
94
133
|
end
|
95
134
|
|
data/lib/my_help/config.rb
CHANGED
@@ -16,6 +16,7 @@ module MyHelp
|
|
16
16
|
editor: ENV["EDITOR"] || "emacs",
|
17
17
|
ext: ".org",
|
18
18
|
verbose: false,
|
19
|
+
bat: false,
|
19
20
|
}
|
20
21
|
@valid_config_keys = @config.keys
|
21
22
|
configure_with(@config[:conf_file])
|
@@ -41,10 +42,13 @@ module MyHelp
|
|
41
42
|
if @valid_config_keys.include? k.to_sym
|
42
43
|
@config[k.to_sym] = v
|
43
44
|
elsif k == "".to_sym
|
44
|
-
print "Valid key words are follows:"
|
45
|
-
|
45
|
+
print "Valid key words are follows: "
|
46
|
+
puts [@valid_config_keys.map{|v| v.to_s}].join(", ")
|
46
47
|
else
|
47
|
-
raise KeyError.new("
|
48
|
+
raise KeyError.new("KeywordError: keyword '#{k}' is invalid.\n
|
49
|
+
Valid key words are follows;
|
50
|
+
#{[@valid_config_keys.map{|v| v.to_s}].join(", ")}
|
51
|
+
",
|
48
52
|
receiver: @config,
|
49
53
|
key: k)
|
50
54
|
end
|
@@ -69,6 +73,7 @@ module MyHelp
|
|
69
73
|
|
70
74
|
# save config in @config[:conf_file]
|
71
75
|
def save_config()
|
76
|
+
puts " save config in #{@config[:conf_file]}"
|
72
77
|
File.write(@config[:conf_file], YAML.dump(config))
|
73
78
|
end
|
74
79
|
|
data/lib/my_help/init.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'colorize'
|
1
2
|
module MyHelp
|
2
3
|
class Init
|
3
4
|
def initialize(config)
|
@@ -5,7 +6,11 @@ module MyHelp
|
|
5
6
|
end
|
6
7
|
|
7
8
|
def help_dir_exist?
|
8
|
-
File.exist?(@config[:local_help_dir])
|
9
|
+
if File.exist?(@config[:local_help_dir])
|
10
|
+
raise "Local help dir exist.\n".red+
|
11
|
+
"local help dir: #{@config[:local_help_dir]};
|
12
|
+
if you are sure, delete local help dir first.".green
|
13
|
+
end
|
9
14
|
end
|
10
15
|
|
11
16
|
def check_conf_exist
|
@@ -13,6 +18,7 @@ module MyHelp
|
|
13
18
|
end
|
14
19
|
|
15
20
|
def mk_help_dir
|
21
|
+
puts "making local help dir: #{@config[:local_help_dir]}"
|
16
22
|
FileUtils.mkdir(@config[:local_help_dir])
|
17
23
|
end
|
18
24
|
|
@@ -20,6 +26,7 @@ module MyHelp
|
|
20
26
|
target_dir = @config[:local_help_dir]
|
21
27
|
src_dir = @config[:template_dir]
|
22
28
|
ext = @config[:ext]
|
29
|
+
puts "cp help templates *#{ext}"
|
23
30
|
Dir.glob(File.join(src_dir, "*#{ext}")).each do |file|
|
24
31
|
FileUtils.cp(file, target_dir, verbose: false)
|
25
32
|
end
|
data/lib/my_help/list.rb
CHANGED
@@ -4,6 +4,7 @@ require "colorized_string"
|
|
4
4
|
|
5
5
|
module MyHelp
|
6
6
|
# Your code goes here...
|
7
|
+
|
7
8
|
class List
|
8
9
|
def initialize(path = "", ext = ".org", layer = 1)
|
9
10
|
@path = path
|
@@ -16,6 +17,7 @@ module MyHelp
|
|
16
17
|
if item == nil && name == nil
|
17
18
|
list_helps()
|
18
19
|
else
|
20
|
+
name = File.basename(name, @ext)
|
19
21
|
path = File.exist?(name + @ext) ? name + @ext :
|
20
22
|
File.join(@path, name + @ext)
|
21
23
|
list_help_with(path, name, item)
|
@@ -24,7 +26,15 @@ module MyHelp
|
|
24
26
|
|
25
27
|
def read_help(file)
|
26
28
|
info = {}
|
27
|
-
|
29
|
+
|
30
|
+
info[:items] = case @ext
|
31
|
+
when '.org'
|
32
|
+
Org2Hash.new(File.read(file)).contents
|
33
|
+
when '.md'
|
34
|
+
Md2Hash.new(File.read(file)).contents
|
35
|
+
else
|
36
|
+
RaiseError(:NoExtension)
|
37
|
+
end
|
28
38
|
info[:name] = File.basename(file).split(".")[0]
|
29
39
|
return info
|
30
40
|
end
|
@@ -35,7 +45,7 @@ module MyHelp
|
|
35
45
|
# p [out, file]
|
36
46
|
help_info = read_help(file)
|
37
47
|
head = help_info[:items]["head"] ?
|
38
|
-
help_info[:items]["head"]
|
48
|
+
help_info[:items]["head"][0] : ''
|
39
49
|
# out << "%10s: %s\n" % [help_info[:name], head]
|
40
50
|
out << "%s: %s\n" %
|
41
51
|
[pad_multi_bytes(help_info[:name],20), head]
|
@@ -43,24 +53,20 @@ module MyHelp
|
|
43
53
|
end
|
44
54
|
|
45
55
|
def pad_multi_bytes(str, length, padstr=" ")
|
46
|
-
str_bytes = str.each_char.map
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
pad = padstr * (length - str_bytes)
|
56
|
+
str_bytes = str.each_char.map { |c| c.bytesize == 1 ? 1 : 2 }.sum
|
57
|
+
pad_length = length - str_bytes
|
58
|
+
|
59
|
+
if pad_length > 0
|
60
|
+
pad = padstr * pad_length
|
52
61
|
return pad + str
|
53
62
|
else
|
54
63
|
return str
|
55
64
|
end
|
56
65
|
end
|
57
66
|
|
58
|
-
|
59
67
|
def list_help_with(path, name, item)
|
60
68
|
@help_info = read_help(path)
|
61
|
-
output =
|
62
|
-
"my_help called with name : #{name},item : #{item}\n"
|
63
|
-
].colorize(:cyan)
|
69
|
+
output = "my_help called with name : #{name},item : #{item}\n"
|
64
70
|
|
65
71
|
if item == nil
|
66
72
|
@help_info[:items].each_pair do |item, val|
|
@@ -84,8 +90,8 @@ module MyHelp
|
|
84
90
|
"Can't find similar item name with : #{input_item}"
|
85
91
|
else
|
86
92
|
contents = candidates.collect do |near_item|
|
87
|
-
ColorizedString["item : #{near_item} \n"].colorize(:cyan) +
|
88
|
-
|
93
|
+
# ColorizedString["item : #{near_item} \n"].colorize(:cyan) +
|
94
|
+
"item : #{near_item} \n" + @help_info[:items][near_item].join("\n")
|
89
95
|
end
|
90
96
|
contents.join("\n")
|
91
97
|
end
|
data/lib/my_help/modify.rb
CHANGED
@@ -2,6 +2,7 @@ module MyHelp
|
|
2
2
|
class Modify
|
3
3
|
def initialize(conf)
|
4
4
|
@conf = conf
|
5
|
+
@ext = @conf[:ext]
|
5
6
|
end
|
6
7
|
|
7
8
|
def new(help_file)
|
@@ -19,13 +20,14 @@ module MyHelp
|
|
19
20
|
end
|
20
21
|
|
21
22
|
def edit(help_name)
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
name = File.basename(help_name[0], @ext)
|
24
|
+
path = File.exist?(name + @ext) ? name + @ext :
|
25
|
+
File.join(@conf[:local_help_dir], name + @ext)
|
26
|
+
if File.exist?(path)
|
27
|
+
p comm = "#{@conf[:editor]} #{path}"
|
26
28
|
system(comm)
|
27
29
|
else
|
28
|
-
puts "file #{
|
30
|
+
puts "file #{path} does not exist,"
|
29
31
|
puts "make #{help_name} first by 'new' command."
|
30
32
|
end
|
31
33
|
end
|
data/lib/my_help/org2hash.rb
CHANGED
@@ -22,7 +22,7 @@ module MyHelp
|
|
22
22
|
|
23
23
|
def simple_fsm()
|
24
24
|
state = :header_read
|
25
|
-
item =
|
25
|
+
item = []
|
26
26
|
@text.split("\n").each do |line|
|
27
27
|
next if line.size < 1
|
28
28
|
state, action = TRANSITIONS[state][line[0..1]] ||
|
@@ -31,9 +31,9 @@ module MyHelp
|
|
31
31
|
when :ignore
|
32
32
|
when :start_new_item
|
33
33
|
item = read_item(line)
|
34
|
-
@contents[item] =
|
34
|
+
@contents[item] = []
|
35
35
|
when :add_contents
|
36
|
-
@contents[item]
|
36
|
+
@contents[item] << line
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
data/lib/my_help/version.rb
CHANGED
@@ -0,0 +1,51 @@
|
|
1
|
+
# head: kickoff for wsl novice
|
2
|
+
|
3
|
+
# license: cc by Shigeto R. Nishitani, 2025
|
4
|
+
|
5
|
+
# initial_operation
|
6
|
+
最初(initial)の操作
|
7
|
+
1. cd comp_a_25s
|
8
|
+
2. git stash # 変更をgitに無かったことに
|
9
|
+
3. git pull origin main # 最新のfilesをgitでpull(引っ張ってくる)
|
10
|
+
4. cp bin/kick_off ~/bin # 最新版のkick_offを~/binにcopy
|
11
|
+
5. cd ~/my_comp_a/python
|
12
|
+
6. cp ~/comp_a_25s/python/hogehoge . # hogehogeファイルを'.'にcp
|
13
|
+
|
14
|
+
# wsl shell commands
|
15
|
+
- cat : catenate # 中身を出力する
|
16
|
+
- cat results | pbcopy(clip.exe)
|
17
|
+
- bat : batcat
|
18
|
+
- kick_off -f | bat -l zsh
|
19
|
+
- python3 d1_print_calendar.py > results.txt
|
20
|
+
- history
|
21
|
+
- history -r | tail -20 | clip.exe
|
22
|
+
- tree, open, code .,
|
23
|
+
|
24
|
+
# directory(path) comms
|
25
|
+
- pwd : print working directory
|
26
|
+
- ls [DIR] : list # defaultは'.'
|
27
|
+
- cd [DIR] : change directory # defaultは'~'
|
28
|
+
- '~' tilde, ホームdirectoryを指す
|
29
|
+
|
30
|
+
# file comms
|
31
|
+
- mv : move
|
32
|
+
- cp : copy
|
33
|
+
- mkdir : make directory
|
34
|
+
- rm : remove
|
35
|
+
- rm -rf DIR # DIRごとremove
|
36
|
+
# editor key binds
|
37
|
+
- c-p(previous)
|
38
|
+
- c-a(ahead), c-b(back), c-f(forward), c-e(end)
|
39
|
+
- c-n(next)
|
40
|
+
- c-d(delete), c-k(kill-line), del
|
41
|
+
- c-y(yank, paste)
|
42
|
+
|
43
|
+
# capture comms
|
44
|
+
- Mac
|
45
|
+
- whole : Shift + Command + 3
|
46
|
+
- select: Shift + Command + 4
|
47
|
+
- window: Shift + Command + 4 , space
|
48
|
+
- Desktopに保存
|
49
|
+
- Windows :
|
50
|
+
- Win + Shift + S, それからIcon操作
|
51
|
+
- 「ピクチャ」->「スクリーンショット」に保存
|
@@ -0,0 +1,57 @@
|
|
1
|
+
#+OPTIONS: ^:{}
|
2
|
+
#+STARTUP: indent nolineimages overview num
|
3
|
+
* head: help_title example
|
4
|
+
* license: cc by Shigeto R. Nishitani, 2016-24
|
5
|
+
* initial_operation
|
6
|
+
最初(initial)の操作
|
7
|
+
1. cd comp_a_25s
|
8
|
+
2. git stash # 変更をgitに無かったことに
|
9
|
+
3. git pull origin main # 最新のfilesをgitでpull(引っ張ってくる)
|
10
|
+
4. cp bin/kick_off ~/bin # 最新版のkick_offを~/binにcopy
|
11
|
+
5. cd ~/my_comp_a/python
|
12
|
+
6. cp ~/comp_a_25s/python/hogehoge . # hogehogeファイルを'.'にcp
|
13
|
+
* wsl shell commands
|
14
|
+
- cat : catenate # 中身を出力する
|
15
|
+
- cat results | pbcopy(clip.exe)
|
16
|
+
# '|' pipe : 出力結果を次のclaに渡す
|
17
|
+
# 'clip.exe'->'pbcopy' for mac users
|
18
|
+
- bat : batcat
|
19
|
+
- kick_off -f | bat -l zsh
|
20
|
+
# | bat -l zsh
|
21
|
+
- python3 d1_print_calendar.py > results.txt
|
22
|
+
# '>' redirect : 出力をfileに保存
|
23
|
+
- history
|
24
|
+
- history -r | tail -20 | clip.exe
|
25
|
+
- tree, open, code .,
|
26
|
+
* directory(path) related commands
|
27
|
+
- pwd : print working directory
|
28
|
+
# 今いる絶対path(dir)
|
29
|
+
- ls [DIR] : list # defaultは'.'
|
30
|
+
# '.' current dir, 今いるdirectory
|
31
|
+
- cd [DIR] : change directory # defaultは'~'
|
32
|
+
# '~' tilde, ホームdirectoryを指す
|
33
|
+
# '..' 一つ上の相対path
|
34
|
+
* file related commands
|
35
|
+
- mv : move
|
36
|
+
- cp : copy
|
37
|
+
- mkdir : make directory
|
38
|
+
- rm : remove
|
39
|
+
- rm -rf DIR # DIRごとremove
|
40
|
+
# recursive 繰り返し(再帰的に), force 強制的に
|
41
|
+
* editor key binds
|
42
|
+
- c-p(previous)
|
43
|
+
- c-a(ahead), c-b(back), c-f(forward), c-e(end)
|
44
|
+
- c-n(next)
|
45
|
+
- c-d(delete), c-k(kill-line), del
|
46
|
+
- c-y(yank, paste)
|
47
|
+
* capture commands
|
48
|
+
Screen capture
|
49
|
+
Mac
|
50
|
+
whole : Shift + Command + 3
|
51
|
+
select: Shift + Command + 4
|
52
|
+
window: Shift + Command + 4 , space
|
53
|
+
Desktopに保存
|
54
|
+
|
55
|
+
Windows :
|
56
|
+
Win + Shift + S, それからIcon操作
|
57
|
+
ピクチャ」->「スクリーンショット」に保存
|
data/my_help.gemspec
CHANGED
@@ -19,13 +19,13 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
21
|
# Uncomment to register a new dependency of your gem
|
22
|
-
spec.add_development_dependency "rspec"
|
22
|
+
# spec.add_development_dependency "rspec"
|
23
23
|
spec.add_runtime_dependency "thor"
|
24
24
|
spec.add_runtime_dependency "command_line"
|
25
25
|
spec.add_runtime_dependency "colorize"
|
26
26
|
# spec.add_development_dependency "aruba"
|
27
|
-
spec.add_development_dependency "yard"
|
28
|
-
spec.add_development_dependency "rubocop"
|
27
|
+
# spec.add_development_dependency "yard"
|
28
|
+
# spec.add_development_dependency "rubocop"
|
29
29
|
# For more information and examples about making a new gem, checkout our
|
30
30
|
# guide at: https://bundler.io/guides/creating_gem.html
|
31
31
|
end
|