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/docs/path_setting.org
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
#+STARTUP: indent nolineimages nofold
|
2
|
-
|
3
|
-
fishで出てくる$PATHがどうやって設定されているか悩んだ.
|
4
|
-
|
5
|
-
* fish
|
6
|
-
[[https://fishshell.com/docs/current/index.html#initialization][fish shell initialization]]に記述がある.
|
7
|
-
|
8
|
-
#+BEGIN_SRC
|
9
|
-
$ emacs /usr/local/Cellar/fish/2.3.1/share/fish/config.fish
|
10
|
-
...
|
11
|
-
# OS X-ism: Load the path files out of /etc/paths and /etc/paths.d/*
|
12
|
-
set -g __fish_tmp_path $PATH
|
13
|
-
...
|
14
|
-
#+END_SRC
|
15
|
-
|
16
|
-
ここではもうすでにあるんで,その前やろな.
|
17
|
-
* osx
|
18
|
-
|
19
|
-
#+BEGIN_SRC
|
20
|
-
cat /etc/profile
|
21
|
-
# System-wide .profile for sh(1)
|
22
|
-
|
23
|
-
if [ -x /usr/libexec/path_helper ]; then
|
24
|
-
eval `/usr/libexec/path_helper -s`
|
25
|
-
fi
|
26
|
-
|
27
|
-
if [ "${BASH-no}" != "no" ]; then
|
28
|
-
[ -r /etc/bashrc ] && . /etc/bashrc
|
29
|
-
#+END_SRC
|
30
|
-
そういえば,profileを実行するというのがあったな...unixの基本のところに...
|
31
|
-
$ PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/opt/X11/bin:/Applications/TeXLive/Library/texlive/2013/bin/universal-darwin:/Applications/TeXLive/Library/mactexaddons/bin:.:/Users/bob/.rbenv/shims:/Users/bob/.rbenv/versions/2.4.3/bin:/Users/bob/anaconda3/bin:/Users/bob/bin:/usr/local/opt/tcl-tk/bin"; export PATH;
|
32
|
-
となっており,すでにrbenvやanaconda3がどっかで定義されている..どこやろ...
|
33
|
-
|
34
|
-
anaconda3とかbrewがどっかを書き換えてるんやろな...
|
35
|
-
|
36
|
-
* brew
|
37
|
-
|
38
|
-
* rbenv
|
39
|
-
|
40
|
-
rbenv init - fish
|
41
|
-
export PATH="/Users/bob/.rbenv/shims:${PATH}"
|
42
|
-
rbenv rehash 2>/dev/null
|
43
|
-
なんで,ここで変えてるのかも...
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
data/exe/e_h
DELETED
data/exe/emacs_help
DELETED
data/exe/m_t
DELETED
data/exe/my_help
DELETED
data/exe/my_todo
DELETED
data/exe/o_h
DELETED
data/exe/org_help
DELETED
data/lib/emacs_help.rb
DELETED
@@ -1,137 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
require "optparse"
|
3
|
-
require "emacs_help/version"
|
4
|
-
|
5
|
-
module EmacsHelp
|
6
|
-
class Command
|
7
|
-
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
|
-
new(argv).execute
|
13
|
-
end
|
14
|
-
|
15
|
-
def initialize(argv=[])
|
16
|
-
@argv = argv
|
17
|
-
data_path = File.join(ENV['HOME'], '.hikirc')
|
18
|
-
end
|
19
|
-
|
20
|
-
def execute
|
21
|
-
@argv << '--help' if @argv.size==0
|
22
|
-
command_parser = OptionParser.new do |opt|
|
23
|
-
opt.on('-v', '--version','show program Version.') { |v|
|
24
|
-
opt.version = EmacsHelp::VERSION
|
25
|
-
puts opt.ver
|
26
|
-
}
|
27
|
-
opt.on('-c','--カーソル','Cursor移動') {cursor_move}
|
28
|
-
opt.on('-p','--ページ','Page移動') {page_move}
|
29
|
-
opt.on('-f','--ファイル','File操作') {file}
|
30
|
-
opt.on('-e','--編集','Edit操作') {edit}
|
31
|
-
opt.on('-w','--ウィンドウ','Window操作') {window}
|
32
|
-
opt.on('-b','--バッファ','Buffer操作') {buffer}
|
33
|
-
opt.on('-q','--終了','終了操作') {quit}
|
34
|
-
opt.on('--edit','edit help contents'){edit_help}
|
35
|
-
opt.on('--edit','edit help contentsを開く'){edit_help}
|
36
|
-
# opt.on('--to_hiki','convert to hikidoc format'){to_hiki}
|
37
|
-
opt.on('--to_hiki','hikiのformatに変更する'){to_hiki}
|
38
|
-
# opt.on('--all','display all helps'){all_help}
|
39
|
-
opt.on('--all','すべてのhelp画面を表示させる'){all_help}
|
40
|
-
# opt.on('--store [item]','store [item] in backfile'){|item| store(item)}
|
41
|
-
opt.on('--store [item]','store [item] でback upをとる'){|item| store(item)}
|
42
|
-
# opt.on('--remove [item]','remove [item] and store in backfile'){|item| remove(item) }
|
43
|
-
opt.on('--remove [item]','remove [item] back upしてるlistを消去する'){|item| remove(item) }
|
44
|
-
# opt.on('--add [item]','add new [item]'){|item| add(item) }
|
45
|
-
opt.on('--add [item]','add new [item]で新しいhelpを作る'){|item| add(item) }
|
46
|
-
# opt.on('--backup_list [val]','show last [val] backup list'){|val| backup_list(val)}
|
47
|
-
opt.on('--backup_list [val]','back upしているlistを表示させる'){|val| backup_list(val)}
|
48
|
-
|
49
|
-
end
|
50
|
-
begin
|
51
|
-
command_parser.parse!(@argv)
|
52
|
-
rescue=> eval
|
53
|
-
p eval
|
54
|
-
end
|
55
|
-
exit
|
56
|
-
end
|
57
|
-
|
58
|
-
def disp(lines)
|
59
|
-
lines.each{|line|
|
60
|
-
if line.include?(',')
|
61
|
-
show line
|
62
|
-
else
|
63
|
-
puts " #{line}"
|
64
|
-
end
|
65
|
-
}
|
66
|
-
end
|
67
|
-
def show(line)
|
68
|
-
puts " #{line}"
|
69
|
-
end
|
70
|
-
|
71
|
-
def quit
|
72
|
-
puts "\n終了操作quit"
|
73
|
-
cont = ["c-x c-c, Quit emacs, ファイルを保存して終了",
|
74
|
-
"c-z, suspend emacs, 一時停止,fgで復活"]
|
75
|
-
disp(cont)
|
76
|
-
end
|
77
|
-
|
78
|
-
def window
|
79
|
-
puts "\nウィンドウ操作window"
|
80
|
-
cont=["c-x 2, 2 windows, 二つに分割",
|
81
|
-
"c-x 1, 1 windows, 一つに戻す",
|
82
|
-
"c-x 3, 3rd window sep,縦線分割",
|
83
|
-
"c-x o, Other windows, 次の画面へ移動"]
|
84
|
-
disp(cont)
|
85
|
-
end
|
86
|
-
|
87
|
-
def buffer
|
88
|
-
puts "\nバッファー操作buffer"
|
89
|
-
cont =[ "c-x b, show Buffer, バッファのリスト",
|
90
|
-
"c-x c-b, next Buffer, 次のバッファへ移動"]
|
91
|
-
disp(cont)
|
92
|
-
end
|
93
|
-
|
94
|
-
def edit
|
95
|
-
puts "\n編集操作editor"
|
96
|
-
cont = ["c-d, Delete char, 一字削除",
|
97
|
-
"c-k, Kill line, 一行抹消,カット",
|
98
|
-
"c-y, Yank, ペースト",
|
99
|
-
"c-w, Kill region, 領域抹消,カット",
|
100
|
-
"領域選択は,先頭or最後尾でc-spaceした後,最後尾or先頭へカーソル移動",
|
101
|
-
"c-s, forward incremental Search WORD, 前へWORDを検索",
|
102
|
-
"c-r, Reverse incremental search WORD, 後へWORDを検索",
|
103
|
-
"M-x query-replace WORD1 <ret> WORD2:対話的置換(y or nで可否選択)"]
|
104
|
-
disp(cont)
|
105
|
-
end
|
106
|
-
|
107
|
-
def file
|
108
|
-
puts "\nファイル操作file"
|
109
|
-
cont =[ "c-x c-f, Find file, ファイルを開く",
|
110
|
-
"c-x c-s, Save file, ファイルを保存",
|
111
|
-
"c-x c-w, Write file NAME, ファイルを別名で書き込む"]
|
112
|
-
disp(cont)
|
113
|
-
end
|
114
|
-
|
115
|
-
def page_move
|
116
|
-
puts "\nページ移動page"
|
117
|
-
cont = ["c-v, move Vertical, 次のページへ",
|
118
|
-
"M-v, move reversive Vertical,前のページへ",
|
119
|
-
"c-l, centerise Line, 現在行を中心に",
|
120
|
-
"M-<, move Top of file, ファイルの先頭へ",
|
121
|
-
"M->, move Bottom of file, ファイルの最後尾へ"]
|
122
|
-
disp(cont)
|
123
|
-
end
|
124
|
-
|
125
|
-
def cursor_move
|
126
|
-
puts "\nカーソル移動cursor"
|
127
|
-
cont = ["c-f, move Forwrard, 前or右へ",
|
128
|
-
"c-b, move Backwrard, 後or左へ",
|
129
|
-
"c-a, go Ahead of line, 行頭へ",
|
130
|
-
"c-e, go End of line, 行末へ",
|
131
|
-
"c-n, move Next line, 次行へ",
|
132
|
-
"c-p, move Previous line, 前行へ"]
|
133
|
-
disp(cont)
|
134
|
-
end
|
135
|
-
|
136
|
-
end
|
137
|
-
end
|
data/lib/my_help/test.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
require 'yaml'
|
3
|
-
require 'coderay'
|
4
|
-
require 'pp'
|
5
|
-
yaml =<<EOF
|
6
|
-
:file:
|
7
|
-
:opts:
|
8
|
-
:short: "-f"
|
9
|
-
:long: "--ファイル"
|
10
|
-
:desc: File操作
|
11
|
-
:title: ファイル操作file
|
12
|
-
:cont:
|
13
|
-
- c-x c-f, Find file, ファイルを開く
|
14
|
-
- c-x c-s, Save file, ファイルを保存
|
15
|
-
- c-x c-w, Write file NAME, ファイルを別名で書き込む
|
16
|
-
EOF
|
17
|
-
pp data=YAML.load(yaml)
|
18
|
-
print YAML.dump(data)
|
19
|
-
|
20
|
-
|
21
|
-
data0={:new_item=>
|
22
|
-
{:opts=>{:short=>"-n", :long=>"--new_item", :desc=>"new item"},
|
23
|
-
:title=>"new_item",
|
24
|
-
:cont=>
|
25
|
-
["new cont"]}}
|
26
|
-
|
27
|
-
print YAML.dump(data0)
|
28
|
-
puts CodeRay.scan(YAML.dump(data0),:yaml).term
|
29
|
-
puts CodeRay.scan(yaml,:yaml).term
|
data/lib/my_help/yml2org.rb
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
require "yaml"
|
3
|
-
|
4
|
-
class YmlToOrg
|
5
|
-
attr_accessor :contents
|
6
|
-
|
7
|
-
def initialize(file)
|
8
|
-
@contents = ''
|
9
|
-
cont = ''
|
10
|
-
if file.kind_of?(String)
|
11
|
-
cont = YAML.load(File.read(file))
|
12
|
-
elsif file.kind_of?(Hash)
|
13
|
-
cont = file
|
14
|
-
end
|
15
|
-
yml_to_org(cont)
|
16
|
-
end
|
17
|
-
|
18
|
-
def plain_element(key, cont)
|
19
|
-
@contents << cont[:cont].join("\n")+"\n" if cont.include?(:cont)
|
20
|
-
end
|
21
|
-
|
22
|
-
def yml_to_org(help_cont)
|
23
|
-
pp help_cont
|
24
|
-
@contents << "#+STARTUP: indent nolineimages\n" # nofold
|
25
|
-
help_cont.each_pair do |key, cont|
|
26
|
-
@contents << "* #{key.to_s}\n"
|
27
|
-
plain_element(key, cont)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
if __FILE__ == $0
|
33
|
-
print YmlToOrg.new(ARGV[0]).contents
|
34
|
-
end
|
data/lib/my_help_thor.rb
DELETED
@@ -1,170 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
require "optparse"
|
3
|
-
require "yaml"
|
4
|
-
require "fileutils"
|
5
|
-
require "my_help/version"
|
6
|
-
require "systemu"
|
7
|
-
require "thor"
|
8
|
-
|
9
|
-
module MyHelp
|
10
|
-
class Command < Thor
|
11
|
-
=begin
|
12
|
-
def self.run(argv=[])
|
13
|
-
new(argv).execute
|
14
|
-
end
|
15
|
-
=end
|
16
|
-
|
17
|
-
def initialize(*args)
|
18
|
-
super
|
19
|
-
# @argv = args
|
20
|
-
@default_help_dir = File.expand_path("../../lib/templates", __FILE__)
|
21
|
-
@local_help_dir = File.join(ENV['HOME'],'.my_help')
|
22
|
-
set_help_dir_if_not_exists
|
23
|
-
end
|
24
|
-
|
25
|
-
desc 'version, -v', 'show program version'
|
26
|
-
# map "--version" => "version"
|
27
|
-
map "--version" => "version"
|
28
|
-
def version
|
29
|
-
puts MyHelp::VERSION
|
30
|
-
end
|
31
|
-
|
32
|
-
desc 'delete NAME, --delete NAME','delete NAME help'
|
33
|
-
map "--delete" => "delete"
|
34
|
-
def delete_help(file)
|
35
|
-
del_files=[]
|
36
|
-
del_files << File.join(@local_help_dir,file)
|
37
|
-
exe_dir=File.join(File.expand_path('../..',@default_help_dir),'exe')
|
38
|
-
del_files << File.join(exe_dir,file)
|
39
|
-
p del_files << File.join(exe_dir,short_name(file))
|
40
|
-
print "Are you sure to delete these files?[yes]"
|
41
|
-
if gets.chomp=='yes' then
|
42
|
-
del_files.each{|file| FileUtils.rm(file,:verbose=>true)}
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
USER_INST_DIR="USER INSTALLATION DIRECTORY:"
|
47
|
-
INST_DIR="INSTALLATION DIRECTORY:"
|
48
|
-
desc 'install_local, --install_local','install local after edit helps'
|
49
|
-
map "--install_local" => "install_local"
|
50
|
-
def install_local
|
51
|
-
|
52
|
-
Dir.chdir(File.expand_path('../..',@default_help_dir))
|
53
|
-
p pwd_dir = Dir.pwd
|
54
|
-
# check that the working dir should not the gem installed dir,
|
55
|
-
# which destroys itself.
|
56
|
-
status, stdout, stderr = systemu "gem env|grep '#{USER_INST_DIR}'"
|
57
|
-
if stdout==""
|
58
|
-
status, stdout, stderr = systemu "gem env|grep '#{INST_DIR}'"
|
59
|
-
end
|
60
|
-
p system_inst_dir = stdout.split(': ')[1].chomp
|
61
|
-
if pwd_dir == system_inst_dir
|
62
|
-
puts "Download my_help from github, and using bundle for edit helps\n"
|
63
|
-
puts "Read README in detail.\n"
|
64
|
-
exit
|
65
|
-
end
|
66
|
-
system "git add -A"
|
67
|
-
system "git commit -m 'update exe dirs'"
|
68
|
-
system "Rake install:local"
|
69
|
-
end
|
70
|
-
|
71
|
-
desc 'clean, --clean', 'clean up exe dir.'
|
72
|
-
map "--clean" => "clean"
|
73
|
-
def clean
|
74
|
-
local_help_entries.each{|file|
|
75
|
-
next if file.include?('emacs_help') or file.include?('e_h')
|
76
|
-
next if file.include?('git_help') or file.include?('t_h')
|
77
|
-
[file, short_name(file)].each{|name|
|
78
|
-
p target=File.join('exe',name)
|
79
|
-
FileUtils::Verbose.rm(target)
|
80
|
-
}
|
81
|
-
}
|
82
|
-
end
|
83
|
-
|
84
|
-
desc 'init NAME, --init NAME', 'initialize NAME help(eg test_help).'
|
85
|
-
map "--init" => "init"
|
86
|
-
def init(file)
|
87
|
-
p target_help=File.join(@local_help_dir,file+'.yml')
|
88
|
-
if File::exists?(target_help)
|
89
|
-
puts "File exists. rm it first to initialize it."
|
90
|
-
exit
|
91
|
-
end
|
92
|
-
p template = File.join(@default_help_dir,'template_help.yml')
|
93
|
-
FileUtils::Verbose.cp(template,target_help)
|
94
|
-
command_template = <<EOS
|
95
|
-
EOS
|
96
|
-
end
|
97
|
-
|
98
|
-
desc 'edit NAME, --edit NAME', 'edit NAME help(eg test_help)'
|
99
|
-
map "--edit" => "edit"
|
100
|
-
def edit(file)
|
101
|
-
p target_help=File.join(@local_help_dir,file+'.yml')
|
102
|
-
system "emacs #{target_help}"
|
103
|
-
end
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
desc 'list, --list', 'list specific helps'
|
108
|
-
map "--list" => "list"
|
109
|
-
def list
|
110
|
-
print "Specific help file:\n"
|
111
|
-
local_help_entries.each{|file|
|
112
|
-
file_path=File.join(@local_help_dir,file)
|
113
|
-
help = YAML.load(File.read(file_path))
|
114
|
-
print " #{file}\t:#{help[:head][0]}\n"
|
115
|
-
}
|
116
|
-
end
|
117
|
-
|
118
|
-
desc 'make, --make', 'make executables for all helps.'
|
119
|
-
map "--make" => "make"
|
120
|
-
def make
|
121
|
-
local_help_entries.each{|file|
|
122
|
-
file_name=file
|
123
|
-
help_name=file
|
124
|
-
help_name=File.basename(help_name,".yml")
|
125
|
-
exe_cont="#!/usr/bin/env ruby\nrequire 'specific_help_opt'\nrequire 'specific_help_thor'\n"
|
126
|
-
exe_cont << "ENV['HELP_NAME']='#{help_name}'\n"
|
127
|
-
exe_cont << "help_file = File.join(ENV['HOME'],'.my_help','#{file_name}')\n"
|
128
|
-
exe_cont << "SpecificHelp::Command.start(ARGV)\n"
|
129
|
-
exe_cont << "SpecificHelpOpt::Command.run(help_file, ARGV)\n"
|
130
|
-
[help_name, short_name(help_name)].each{|name|
|
131
|
-
p target=File.join('exe',name)
|
132
|
-
File.open(target,'w'){|file| file.print exe_cont}
|
133
|
-
FileUtils.chmod('a+x', target, :verbose => true)
|
134
|
-
}
|
135
|
-
}
|
136
|
-
install_local
|
137
|
-
end
|
138
|
-
|
139
|
-
no_commands do
|
140
|
-
def set_help_dir_if_not_exists
|
141
|
-
return if File::exists?(@local_help_dir)
|
142
|
-
FileUtils.mkdir_p(@local_help_dir, :verbose=>true)
|
143
|
-
Dir.entries(@default_help_dir).each{|file|
|
144
|
-
next if file=='template_help'
|
145
|
-
file_path=File.join(@local_help_dir,file)
|
146
|
-
next if File::exists?(file_path)
|
147
|
-
FileUtils.cp((File.join(@default_help_dir,file)),@local_help_dir,:verbose=>true)
|
148
|
-
}
|
149
|
-
end
|
150
|
-
|
151
|
-
# desc 'test2', 'test3'
|
152
|
-
def local_help_entries
|
153
|
-
entries= []
|
154
|
-
Dir.entries(@local_help_dir).each{|file|
|
155
|
-
next unless file.include?('_')
|
156
|
-
next if file[0]=='#' or file[-1]=='~' or file[0]=='.'
|
157
|
-
entries << file
|
158
|
-
}
|
159
|
-
return entries
|
160
|
-
end
|
161
|
-
|
162
|
-
# desc 'test4', 'test5'
|
163
|
-
def short_name(file)
|
164
|
-
file_name=file.split('_')
|
165
|
-
return file_name[0][0]+"_"+file_name[1][0]
|
166
|
-
end
|
167
|
-
end
|
168
|
-
|
169
|
-
end
|
170
|
-
end
|