my_help 27016635 2020 3
1 3 1.1....................................... 3 1.2....................................... 3 1.3 my_help..................................... 3 2 5 2.1.................................. 5 2.2................................. 5 2.3....................................... 6 2.4....................................... 6 2.5....................................... 7 3 gli thor 8 3.1 gli thor.................................... 8 3.2.............................. 9 3.3................................ 9 3.4....................................... 10 4 11 4.1.................................. 11 4.2.............................. 11 4.3................................. 11 4.4 Linux................................. 12 4.5 vim.................................. 13 4.6............................ 14 4.7....................................... 15 5 16 5.1............................. 16 5.2..................................... 16 5.2.1 mac................................... 16 5.2.2 linux................................... 16 5.2.3 windows................................. 17 5.3...................................... 18 1
6 22 2
1 1.1 my_help my_help my_help 1.2 my_help my_help mac emacs 3 mac emacs my_help OSX emacs OS Linux vim my_help windows my_help OS emacs my_help gli thor my_help 1.3 my_help my_help CUI(CLA) Usage user help gem 3
user man format, looks,, 5 [1] manual my_help orgmode orgmode HTML L A TEX my_help 1.1 1.1: my_help_sample. 4
2 2.1 gem my_help > gem install my_help > my_help Commands: my_help delete HELP my_help edit HELP my_help git [push pull] my_help help [COMMAND] my_help list [HELP] [ITEM] my_help new HELP my_help set_editor EDITOR_NAME my_help setup my_help version # delete HELP # edit HELP # git push or pull # Describe available commands or one specif... # list all helps, specific HELP, or ITEM # make new HELP # set editor to EDITOR_NAME # set up the test database # show version my_help 0.8.5 version > my_help version 0.8.5 2.2 my_help > my_help set_editor emacs set editor emacs emacs editor my_help set_editor 5
2.3 help sample help help new > my_help new sample "/Users/keigo/.my_help/sample.org" "/Users/keigo/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/ my_help-0.8.5/lib/templates/help_template.org" cp /Users/keigo/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/ my_help-0.8.5/lib/templates/help_template.org /Users/keigo/.my_help/sample.org sample help 2.4 sample edit > my_help edit sample "/Users/keigo/.my_help/sample.org 2.1 edit sample 2.1: edit_sample. sample emacs org 6
2.5 sample delete delete Y > my_help delete sample Are you sure to delete /Users/keigo/.my_help/sample.org?[Yn] Y rm /Users/keigo/.my_help/sample.org sample Y return 7
3 gli thor 3.1 gli thor my_help gli gem gli my_help gli gli thor Build command-suite CLI apps that are awesome. Bootstrap your app, add commands, options and documentation while maintaining a well-tested idiomatic command-line app gli CLI [2] Thor is a toolkit for building powerful command-line interfaces. thor thor [3] gli thor 3.1 [4] 3.1: gli thor. gli thor Ruby Ruby 1600 30000 Level3 Level5 gli thor Ruby gli 1600 thor 3 thor my_help gli thor my_help 8
3.2 github daddygongon my_help my_help bundle gli thor 3.3 my_help new gli thor new my_help help new gli thor DSL(Domain Specific language) desc make new HELP_NAME help arg_name HELP_NAME command :new do c c.action do global_options,options,args $control.init_help(args[0]) end end gli desc arg_name ruby method block (c) args desc "new HELP", "make new HELP" def new(help_name) invoke :setup $control.init_help(help_name) end thor DSL method gli my_help thor 9
3.4 gli thor my_help gli thor 40% my_help thor my_help gli thor 10
4 4.1 my_help OSX emacs 3 gli thor my_help [5] OSX OS emacs 4.2 mac OS my_help ubuntu mac Linux Linux my_help emacs my_help vim my_help vim my_help mac Linux emacs vim OS my_help 4.3 Vagrant Vagrant [6] macos 64-bit vagrant.pkg > which vagrant /usr/local/bin/vagrant vagrant vagrant > mkdir vagrant_test 11
> cd vagrant_test vagrant_test ubuntu bento/ubuntu-18.04 > vagrant init bento/ubuntu-18.04 ls vagrant_test Vagrantfile ~/vagrant_test> ls Vagrantfile Vagrantfile #config.vm.network "private_network", ip:"192.168.33.10" config.vm.network "private_network", ip:"192.168.33.10" > vagrant up ubuntu 4.4 Linux OSX ubuntu ubuntu > vagrant ssh Welcome to Ubuntu 18.04.3 LTS (GNU/Linux 4.15.0-65-generic x86_64) mac keigo@mac-no-macbook-air ~/vagrant_test vagrant@vagrant:~ vagrant ssh ubuntu my_help 12
$ gem install my_help $ my_help Commands: my_help delete HELP my_help edit HELP my_help git [push pull] my_help help [COMMAND] my_help list [HELP] [ITEM] my_help new HELP my_help set_editor EDITOR_NAME my_help setup my_help version # delete HELP # edit HELP # git push or pull # Describe available commands or one specif... # list all helps, specific HELP, or ITEM # make new HELP # set editor to EDITOR_NAME # set up the test database # show version my_help $ exit logout Connection to 127.0.0.1 closed.. 4.5 vim my_help emacs ubuntu emacs vim vim my_help emacs my_help my_help my_help/lib/my_help/my_help_controll.rb initialize my_help emacs @editor = emacs my_help emacs vim emacs vim @editor = vim 4.1 emacs vim vim 13
4.6 4.1: my_help_vim. my_help initialize my_help set_editor def set_editor(editor) @editor = editor file_name =.my_help_conf.yml @conf_file = File.join(@local_help_dir, file_name) conf = {editor: editor} File.open(@conf_file, w ){ f YAML.dump(conf, f)} puts "set editor #{@editor} " end set_editor editor.my_help_conf.yml vim > my_help set_editor vim set editor vim 14
set_editor my_help 4.7 my_help Linux my_help set_editor my_help OS, user my_help user 15
5 5.1 my_help OS 22 2 help version my_help 5.2 22 my_help 0.8.2 mac linux windows 3 5.2.1 mac mac my_help OSX emacs my_help ruby ruby emacs atom vim 5.2.2 linux linux 3 my_help thor thor 16
5.2.3 windows windows windows10 powerwhell Encoding default Windows-31J force_encoding [7] The associated Encoding of a String can be changed in two different ways. First, it is possible to set the Encoding of a string to a new Encoding without changing the internal byte representation of the string, with String#force_encoding. This is how you can tell Ruby the correct encoding of a string. String#force_encoding Ruby string #=> "R\xC3\xA9sum\xC3\xA9" string.encoding #=> #<Encoding:ISO-8859-1> string.force_encoding(encoding::utf_8) #=> "R\u00E9sum\u00E9" Second, it is possible to transcode a string, i.e. translate its internal byte representation to another encoding. Its associated encoding is also set to the other encoding. See String#encode for the various forms of transcoding, and the Encoding::Converter class for additional control over the transcoding process. Encording String#encode Encoding::Converter string #=> "R\u00E9sum\u00E9" string.encoding #=> #<Encoding:UTF-8> string = string.encode!(encoding::iso_8859_1) #=> "R\xE9sum\xE9" string.encoding #=> #<Encoding::ISO-8859-1> 17
if m = line.match(/^\* (.+)/) m=line.force_encoding(encoding::utf_8).match(/^\* (.+)/u) if m line Encoding UTF-8 match(/... /u) utf matching [8]. windows 5.3 delete %my_help delete test my_help delete test Are you sure to delete /home/user/.my_help/test.org?[ynq] %my_help delete test my_help delete test Are you sure to delete /home/user/.my_help/test.org?[ynq] y %my_help delete test my_help delete test Are you sure to delete /home/user/.my_help/test.org?[ynq] Y rm /home/user/.my_help/test.org delete delete help yes or no [Ynq] y Y my_help delete Enter [Ynq], y Y( ) y Y my_help initialize 18
don t work on version check. change line order between load_conf and set_dir... my_help load_conf set_help_dir_if_not_exists def load_conf file_name =.my_help_conf.yml # @conf_file = File.join(Dir.pwd, file_name) @conf_file = File.join(@local_help_dir, file_name) begin conf = YAML.load_file(@conf_file) @editor = conf[:editor] rescue => e puts e.to_s.red puts make.my_help_conf.yml.green set_editor(@editor) end end load_conf set_editor load_conf def set_help_dir_if_not_exists return if File::exist?(@local_help_dir) FileUtils.mkdir_p(@local_help_dir, :verbose=>true) Dir.entries(@template_dir).each{ file next if file== help_template.org file_path=file.join(@local_help_dir,file) next if File::exists?(file_path) FileUtils.cp((File.join(@template_dir,file)),@local_help_dir,:verbose=>true) } end set_help_dir_if_not_exists local_help_dir my_help list 19
new_help.org #* license - cc by Shigeto R. Nishitani, 2016 #* head - #* item1_example - item1 #* item2_example - item2 my_help list new_help "item1_example" "-i" "item2_example" -, head : head, license : license -i, item1_example : item1_example, item2_example : item2_example my_help list new_help -i "item1_example" - ----- item1_example - item1 org ITEM ITEM 5.1 help item1_example item2_example list item2_example > my_help list new_help -i - ----- item2_example - item2 20
5.1: my_help_item. list list 21
6 my_help gem gli thor set_editor windows my_help OSX emacs OS my_help OS, user my_help. 22
23
[1] my_help, https://github.com/daddygongon/my_help, (accessed on 6 Feb 2020). [2] gli, https://rubygems.org/gems/gli, (accessed on 6 Feb 2020). [3] thor, https://rubygems.org/gems/thor, (accessed on 6 Feb 2020). [4] glivsthor, https://ruby.libhunt.com/compare-gli-vs-thor, (accessed on 6 Feb 2020). [5], " my_help ", (2020). [6] vagrant_download, https://www.vagrantup.com/downloads.html, (accessed on 6 Feb 2020). [7] Encoding(Ruby 2.2.0), https://ruby-doc.org/core-2.2.0/encoding.html, (accessed on 6 Feb 2020). [8] Regexp (Ruby 2.2.0), https://ruby-doc.org/core-2.2.0/regexp.html# class-regexp-label-encoding, (accessed on 6 Feb 2020). 24