my_help 0.4.3 → 0.4.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/.DS_Store +0 -0
  3. data/.gitignore +1 -0
  4. data/.rspec +2 -0
  5. data/Gemfile +1 -0
  6. data/README.md +1 -1
  7. data/Rakefile +35 -12
  8. data/exe/{todo_help → my_todo} +1 -1
  9. data/hikis/diff_against_org-mode.hiki +34 -0
  10. data/hikis/tmp.org +20 -0
  11. data/lib/.emacs_help.rb.swp +0 -0
  12. data/lib/daddygongon/my_todo.yml +31 -0
  13. data/lib/emacs_help.rb +15 -0
  14. data/lib/emacs_help.rb~ +137 -0
  15. data/lib/my_help/test.rb +3 -0
  16. data/lib/my_help/version.rb +1 -1
  17. data/lib/my_help.rb +1 -1
  18. data/lib/my_todo/my_todo.rb +7 -0
  19. data/lib/my_todo/my_todo.rb~ +7 -0
  20. data/lib/specific_help.rb +42 -11
  21. data/lib/specific_help.rb~ +193 -0
  22. data/lib/todo.rb +1 -0
  23. data/lib/todo.rb~ +1 -0
  24. data/lor +0 -0
  25. data/my_help.gemspec +4 -2
  26. data/my_help.wiki/Home.md +1 -1
  27. data/my_help.wiki/README_ja.md +1 -1
  28. data/my_help_nasu/.DS_Store +0 -0
  29. data/my_help_nasu/.gitignore +1 -0
  30. data/my_help_nasu/Rakefile +422 -0
  31. data/my_help_nasu/code.hiki +285 -0
  32. data/my_help_nasu/consideration.hiki +8 -0
  33. data/my_help_nasu/features.hiki +185 -0
  34. data/my_help_nasu/figs/my_help_nasu.001.jpeg +0 -0
  35. data/my_help_nasu/figs/my_help_nasu.001.jpg +0 -0
  36. data/my_help_nasu/figs/my_help_nasu1.001.jpg +0 -0
  37. data/my_help_nasu/head2.tex +9 -0
  38. data/my_help_nasu/hiki_help.yml +53 -0
  39. data/my_help_nasu/introduction.hiki +29 -0
  40. data/my_help_nasu/key_bind_mi +1 -0
  41. data/my_help_nasu/latex_dir/.gitignore +1 -0
  42. data/my_help_nasu/latex_dir/Rakefile +420 -0
  43. data/my_help_nasu/latex_dir/code.aux +25 -0
  44. data/my_help_nasu/latex_dir/code.tex +271 -0
  45. data/my_help_nasu/latex_dir/consideration.aux +22 -0
  46. data/my_help_nasu/latex_dir/consideration.tex +9 -0
  47. data/my_help_nasu/latex_dir/features.aux +31 -0
  48. data/my_help_nasu/latex_dir/features.tex +173 -0
  49. data/my_help_nasu/latex_dir/head.tex +9 -0
  50. data/my_help_nasu/latex_dir/hiki_help.yml +53 -0
  51. data/my_help_nasu/latex_dir/introduction.aux +22 -0
  52. data/my_help_nasu/latex_dir/introduction.tex +23 -0
  53. data/my_help_nasu/latex_dir/jlisting.sty +216 -0
  54. data/my_help_nasu/latex_dir/jlisting.tex +216 -0
  55. data/my_help_nasu/latex_dir/latex_dir/head.tex +9 -0
  56. data/my_help_nasu/latex_dir/latex_dir/jlisting.tex +216 -0
  57. data/my_help_nasu/latex_dir/latex_dir/pre.tex +36 -0
  58. data/my_help_nasu/latex_dir/method_bdd.aux +26 -0
  59. data/my_help_nasu/latex_dir/method_bdd.tex +28 -0
  60. data/my_help_nasu/latex_dir/method_cucumber.aux +28 -0
  61. data/my_help_nasu/latex_dir/method_cucumber.log +28 -0
  62. data/my_help_nasu/latex_dir/method_cucumber.tex +205 -0
  63. data/my_help_nasu/latex_dir/method_usage.aux +28 -0
  64. data/my_help_nasu/latex_dir/method_usage.tex +76 -0
  65. data/my_help_nasu/latex_dir/my_help_nasu.aux +12 -0
  66. data/my_help_nasu/latex_dir/my_help_nasu.log +328 -0
  67. data/my_help_nasu/latex_dir/my_help_nasu.pdf +0 -0
  68. data/my_help_nasu/latex_dir/my_help_nasu.synctex.gz +0 -0
  69. data/my_help_nasu/latex_dir/my_help_nasu.tex +74 -0
  70. data/my_help_nasu/latex_dir/my_help_nasu.toc +32 -0
  71. data/my_help_nasu/latex_dir/overview.aux +21 -0
  72. data/my_help_nasu/latex_dir/overview.tex +12 -0
  73. data/my_help_nasu/latex_dir/pre.tex +36 -0
  74. data/my_help_nasu/method_bdd.hiki +24 -0
  75. data/my_help_nasu/method_cucumber.hiki +184 -0
  76. data/my_help_nasu/method_usage.hiki +69 -0
  77. data/my_help_nasu/my_help_nasu/.DS_Store +0 -0
  78. data/my_help_nasu/my_help_nasu/my_help_nasu.001.jpeg +0 -0
  79. data/my_help_nasu/my_help_nasu.hiki +32 -0
  80. data/my_help_nasu/my_help_nasu.key +0 -0
  81. data/my_help_nasu/overview.hiki +11 -0
  82. data/tmp.txt +2 -0
  83. metadata +104 -10
  84. data/lib/daddygongon/git_help.yml +0 -30
  85. data/lib/daddygongon/todo_help.yml +0 -58
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6c2bdfb447c8b0ca56b53f11a658047c5b13a23e
4
- data.tar.gz: 838b8b528c1ca11cb113f3a4be3b255bea033e79
3
+ metadata.gz: e39311df22368bc26a3e013c3e11aee80f07ec0f
4
+ data.tar.gz: 3bac2af4a06ab1576441731fcc7ce628ee695426
5
5
  SHA512:
6
- metadata.gz: 191a177b17252565c7d7257a559f133e65ca7757fc76774081d40ff0ed01823cb497b8a5a9eb58d7b0ea20c3c196c62ecf6db08797a58f98609fc969420e40cf
7
- data.tar.gz: debfc0d4458e08ec198a6774860ad4013994ec17cc796f85801af75f056e52d59230cd59d2a73eb322a6bdee24d61eb5795b9ef03a226d61976f191789e44fe9
6
+ metadata.gz: b15b61e5e582900f7ee4c4279ba1937baaa13a8500ca2bf19b0d83d8b87bce781a460f6f256224ccaf4119c31851a73221f3b19678257859d6f780788bbffeb4
7
+ data.tar.gz: a0961f686628e9e8ec8fbf60a81ab914783994211bcc32cbdde9ffde93ff4b96e10e7befa603d08b4fd5d0c2707a30496f7c38c24f5355becc12dcbbb74a3138
data/.DS_Store ADDED
Binary file
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
+ /.DS_Store/
1
2
  /.bundle/
2
3
  /.yardoc
3
4
  /Gemfile.lock
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/Gemfile CHANGED
@@ -2,3 +2,4 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in my_help.gemspec
4
4
  gemspec
5
+ gem 'aruba', '~> 0.14.2'
data/README.md CHANGED
@@ -327,4 +327,4 @@ add_yml, to_ymlは3.6から4.0へ移行する時に行ったhelpファイルの
327
327
  add_ymlは~/.my_help/*_helpファイルを全て~/.my_help/*_help.ymlに変える.
328
328
  to_ymlは~/.emacs.d/init.elに'.yml'の設定が書き込まれていない時,ruby-modeでemacsを起動するsciptを埋め込む.
329
329
 
330
- clean_exeは,githubへuploadする時に,開発者個人のhelpファイルをrmして整頓する.
330
+ clean_exeは,githubへuploadする時に,開発者個人のexeファイルをrmして整頓する.
data/Rakefile CHANGED
@@ -1,7 +1,11 @@
1
+ # -*- coding: utf-8 -*-
1
2
  require "bundler/gem_tasks"
2
3
  require 'yard'
3
- require "rake/testtask"
4
+ #require "rake/testtask"
5
+ require "rspec/core/rake_task"
4
6
  require 'fileutils'
7
+ require 'cucumber/rake/task'
8
+
5
9
  p base_path = File.expand_path('..', __FILE__)
6
10
  p basename = File.basename(base_path)
7
11
 
@@ -9,6 +13,35 @@ task :default do
9
13
  system 'rake -T'
10
14
  end
11
15
 
16
+ desc "cucumber with Japanese"
17
+ task :cucumber do
18
+ Cucumber::Rake::Task.new do |t|
19
+ t.cucumber_opts = %w{--format pretty -l ja}
20
+ end
21
+ end
22
+
23
+ desc "rspec test for aruba"
24
+ task :rspec do
25
+ RSpec::Core::RakeTask.new(:spec)
26
+ end
27
+
28
+ desc "auto re-install"
29
+ task :auto_reinstall do
30
+ puts "[sudo] gem uninstall my_help"
31
+ puts "cd my_help"
32
+ puts "git remote add upstrem git@github.com:daddygongon/my_help.git"
33
+ puts "git pull upstrem master"
34
+ puts "rake clean_exe"
35
+ puts "rake to_yml"
36
+ puts "*cp lib/daddygongon/my_todo.yml ~/.my_help"
37
+ puts "[sudo] bundle exec exe/my_help -m"
38
+ puts "*source ~/.zshrc or source ~/.cshrc"
39
+ puts "*my_help -l"
40
+ puts "*rake add_yml"
41
+ puts "*--editで編集画面を開けてみて,色が付いてなかったら,"
42
+ puts "*mv ~/.emacs ~/.emacs.d/init.elを試してみる"
43
+ end
44
+
12
45
  desc "add .yml mode on ~/.emacs.d/init.el"
13
46
  task :add_yml do
14
47
  adds = <<EOS
@@ -47,7 +80,7 @@ task :clean_exe do
47
80
  files = Dir.entries('exe')
48
81
  files.each{|file|
49
82
  next if ["my_help",".","..",".DS_Store",
50
- "emacs_help","e_h","todo_help"].include?(file)
83
+ "emacs_help","e_h","my_todo"].include?(file)
51
84
  FileUtils.rm(File.join('./exe',file), :verbose=>true)
52
85
  }
53
86
  end
@@ -75,13 +108,3 @@ task :hiki2md do
75
108
  FileUtils.cp(readme_ja,"#{basename}.wiki/Home.md",:verbose=>true)
76
109
  end
77
110
 
78
- desc "transfer hikis/*.hiki to latex"
79
- task :latex do
80
- target = 'handout_sample'
81
- command = "hiki2latex --pre latexes/handout_pre.tex hikis/#{target}.hiki > latexes/#{target}.tex"
82
- system command
83
- command = "open latexes/#{target}.tex"
84
- system command
85
- end
86
-
87
-
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'specific_help'
3
- help_file = File.join(ENV['HOME'],'.my_help','todo_help.yml')
3
+ help_file = File.join(ENV['HOME'],'.my_help','my_todo.yml')
4
4
  SpecificHelp::Command.run(help_file, ARGV)
@@ -0,0 +1,34 @@
1
+ !emacsのorg-modeとかぶるところがたくさんある.
2
+
3
+ !!共通点
4
+ *軽い,
5
+ *保存場所の共通化でどこでも立ち上がる
6
+ *標準(mark dowon)的な記述言語
7
+ *todoとmemoが同じ環境
8
+ *カラー表示
9
+ *emacsでの編集
10
+ *リスト,バックアップ,
11
+ などだれでも考えることは同じなんや.
12
+
13
+ でも,
14
+
15
+ !!相違点
16
+ #shellかemacsか
17
+ #emacs以外で使える
18
+ #org-mode独自のコマンドを覚えなくても使える
19
+ #rubyでのcoding
20
+ #ymlデータの共有
21
+ なんかがあります.
22
+
23
+ つまり,my_helpの使用想定としては,
24
+ * emacsを使いたくないexpert
25
+ * org-modeを覚えていないnovice
26
+ * memoなんかをチューンアップしたいrubyist
27
+ というところです.
28
+
29
+ まあ,my_help開発に全く意義がないと否定しないでください.
30
+ これらの人を対象として,
31
+ * EDITOR設定を反映
32
+ * orgへのymlからの変換機能の提供
33
+ * githubでの公開
34
+ を行っています.
data/hikis/tmp.org ADDED
@@ -0,0 +1,20 @@
1
+ *TODO org-mode_helpをつくる
2
+ ** M-x org-mode
3
+ ** TODOと書く
4
+ ** c-c c-tでTODO->DONE-> no titleと変遷(trans)
5
+ ** c-iでoutline的に出したり,入れたり.
6
+ * Daily
7
+ ** TODO fixとfullrelaxを同時に作っていいやん!!いらんかったら後で消せばいい.
8
+ **TODO RSpec, cucumberのPart2を読み切る
9
+ **TODO 3325_3のfull_relaxを...
10
+ ** TODO 3325をもっと下げる方法を考えな.サイズをあげる
11
+ * Weekly
12
+ **TODO ruby terminal colorizing, https://www.ruby-toolbox.com/categories/Terminal_Coloring
13
+ ** DONE Coderayを使って書き換え,http://melborne.github.io/2010/11/07/Ruby-ANSI/, あまりいいのがない, TaskPaperで少し良くなったかも.
14
+ **TODO my_helpのbehavior記述を日本語で.
15
+ **TODO hikutilsのoption書き換えをthorと比較.
16
+ **TODO rubynoviceのテストをarubaで.
17
+ **TODO golfscore appli, 一打ずつ記録するアプリはない,自分のメモ代わりにも
18
+ **TODO faviconの作成
19
+ **TODO Rakefileをどうやってinstallするか...
20
+ **TODO org-mode_helpをつくってしばらく使ってみる.
Binary file
@@ -0,0 +1,31 @@
1
+ # -*- coding: utf-8 -*-
2
+ ---
3
+ #start header, which appears every time.
4
+ :head: #never change
5
+ - my todo
6
+
7
+ :license:
8
+ - " cc by Shigeto R. Nishitani, 2016"
9
+
10
+ :daily:
11
+ :opts:
12
+ :short: -d
13
+ :long: --daily
14
+ :desc: daily(今日のtodo)
15
+ :title: daily(今日のtodo)
16
+ :cont:
17
+ - ご飯を食べる
18
+ - 10時には寝床へ入る
19
+
20
+ :weekly:
21
+ :opts:
22
+ :short: -w
23
+ :long: --weekly
24
+ :desc: weekly(週間todo)
25
+ :title: weekly(週間todo)
26
+ :cont:
27
+ - 毎日8時間寝る
28
+ - 毎朝ちゃんと食べる
29
+
30
+
31
+
data/lib/emacs_help.rb CHANGED
@@ -31,6 +31,21 @@ module EmacsHelp
31
31
  opt.on('-w','--ウィンドウ','Window操作') {window}
32
32
  opt.on('-b','--バッファ','Buffer操作') {buffer}
33
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
+
34
49
  end
35
50
  begin
36
51
  command_parser.parse!(@argv)
@@ -0,0 +1,137 @@
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 CHANGED
@@ -1,5 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  require 'yaml'
3
+ require 'coderay'
3
4
  require 'pp'
4
5
  yaml =<<EOF
5
6
  :file:
@@ -24,3 +25,5 @@ data0={:new_item=>
24
25
  ["new cont"]}}
25
26
 
26
27
  print YAML.dump(data0)
28
+ puts CodeRay.scan(YAML.dump(data0),:yaml).term
29
+ puts CodeRay.scan(yaml,:yaml).term
@@ -1,3 +1,3 @@
1
1
  module MyHelp
2
- VERSION = "0.4.3"
2
+ VERSION = "0.4.4"
3
3
  end
data/lib/my_help.rb CHANGED
@@ -109,7 +109,7 @@ module MyHelp
109
109
 
110
110
  def clean_exe
111
111
  local_help_entries.each{|file|
112
- next if ['emacs_help','e_h','todo_help','todo_help'].include?(file)
112
+ next if ['emacs_help','e_h','my_help','my_todo'].include?(file)
113
113
  file = File.basename(file,'.yml')
114
114
  [file, short_name(file)].each{|name|
115
115
  p target=File.join('exe',name)
@@ -0,0 +1,7 @@
1
+ module Mytodo
2
+ class Todo
3
+ def open
4
+ end
5
+ end
6
+ end
7
+
@@ -0,0 +1,7 @@
1
+ module My_todo
2
+ class Todo
3
+ def open
4
+ end
5
+ end
6
+ end
7
+
data/lib/specific_help.rb CHANGED
@@ -3,6 +3,8 @@ require "optparse"
3
3
  require "yaml"
4
4
  require "my_help/version"
5
5
  require 'fileutils'
6
+ require "coderay"
7
+ require 'colorize'
6
8
 
7
9
  module SpecificHelp
8
10
  class Command
@@ -37,13 +39,23 @@ module SpecificHelp
37
39
  opts = val[:opts]
38
40
  opt.on(opts[:short],opts[:long],opts[:desc]) {disp_help(key)}
39
41
  }
40
- opt.on('--edit','edit help contents'){edit_help}
41
- opt.on('--to_hiki','convert to hikidoc format'){to_hiki}
42
- opt.on('--all','display all helps'){all_help}
43
- opt.on('--store [item]','store [item] in backfile'){|item| store(item)}
44
- opt.on('--remove [item]','remove [item] and store in backfile'){|item| remove(item) }
45
- opt.on('--add [item]','add new [item]'){|item| add(item) }
46
- opt.on('--backup_list [val]','show last [val] backup list'){|val| backup_list(val)}
42
+
43
+ opt.on('--edit','edit help contentsを開く'){edit_help}
44
+ opt.on('--to_hiki','hikiのformatに変更する'){to_hiki}
45
+ opt.on('--all','すべてのhelp画面を表示させる'){all_help}
46
+ opt.on('--store [item]','store [item] でback upをとる'){|item| store(item)}
47
+ opt.on('--remove [item]','remove [item] back upしてるlistを消去する'){|item| remove(item) }
48
+ opt.on('--add [item]','add new [item]で新しいhelpを作る'){|item| add(item) }
49
+ opt.on('--backup_list [val]','back upしているlistを表示させる'){|val| backup_list(val)}
50
+
51
+ # opt.on('--edit','edit help contents'){edit_help}
52
+ # opt.on('--to_hiki','convert to hikidoc format'){to_hiki}
53
+ # opt.on('--all','display all helps'){all_help}
54
+ # opt.on('--store [item]','store [item] in backfile'){|item| store(item)}
55
+ # opt.on('--remove [item]','remove [item] and store in backfile'){|item| remove(item) }
56
+ # opt.on('--add [item]','add new [item]'){|item| add(item) }
57
+ # opt.on('--backup_list [val]','show last [val] backup list'){|val| backup_list(val)}
58
+
47
59
  end
48
60
  begin
49
61
  command_parser.parse!(@argv)
@@ -79,7 +91,12 @@ module SpecificHelp
79
91
  end
80
92
 
81
93
  def store(item)
82
- print "Trying to store #{item}\n"
94
+ if item==nil
95
+ print "spcify --store [item].\n"
96
+ exit
97
+ else
98
+ print "Trying to store #{item}\n"
99
+ end
83
100
  backup=mk_backup_file(@source_file)
84
101
  unless store_item = @help_cont[item.to_sym] then
85
102
  print "No #{item} in this help. The items are following...\n"
@@ -90,6 +107,7 @@ module SpecificHelp
90
107
  exit
91
108
  end
92
109
  p store_name = item+"_"+Time.now.strftime("%Y%m%d_%H%M%S")
110
+ cont = {store_name.to_sym => store_item}
93
111
  backup_cont=YAML.load(File.read(backup)) || {}
94
112
  backup_cont[store_name.to_sym]=store_item
95
113
  File.open(backup,'w'){|file| file.print(YAML.dump(backup_cont))}
@@ -111,7 +129,16 @@ module SpecificHelp
111
129
  end
112
130
 
113
131
  def edit_help
114
- system("emacs #{@source_file}")
132
+ p help_file =@source_file
133
+ begin
134
+ p command= "emacs #{help_file}"
135
+ exec command
136
+ rescue => e
137
+ print "\nOption edit is not executable on windows. \n"
138
+ print "Type the following shell command;\n\n"
139
+ print "emacs /home/#{ENV['USER']}/.my_help/#{File.basename(@source_file)}\n\n"
140
+ print "M-x ruby-mode should be good for edit.\n"
141
+ end
115
142
  end
116
143
 
117
144
  def to_hiki
@@ -127,6 +154,7 @@ module SpecificHelp
127
154
  def all_help
128
155
  @help_cont.each_pair{|key,val|
129
156
  if key==:head or key==:license
157
+ val[0]+=":"
130
158
  disp(val)
131
159
  else
132
160
  disp_help(key)
@@ -147,13 +175,16 @@ module SpecificHelp
147
175
  def disp_help(key_word)
148
176
  print_separater
149
177
  items =@help_cont[key_word]
150
- puts items[:title]
178
+ puts items[:title].magenta
179
+ # puts CodeRay.scan("-#{items[:title]}:", :Taskpaper).term
151
180
  disp(items[:cont])
152
181
  print_separater
153
182
  end
154
183
 
155
184
  def disp(lines)
156
- lines.each{|line| puts " *#{line}"} if lines != nil
185
+ # lines.each{|line| puts " +#{line}"} if lines != nil
186
+ lines.each{|line| puts "*#{line}".blue}
187
+ # lines.each{|line| puts CodeRay.scan("+#{line}", :Taskpaper).term}
157
188
  end
158
189
 
159
190
  def print_separater