Class: Milkode::CLI
- Inherits:
-
Thor
- Object
- Thor
- Milkode::CLI
- Defined in:
- lib/milkode/cli.rb
Instance Method Summary collapse
- #add(*args) ⇒ Object
- #cleanup(*args) ⇒ Object
- #config(*args) ⇒ Object
- #dir(*args) ⇒ Object
- #dump ⇒ Object
- #fav(*paths) ⇒ Object
- #files(*args) ⇒ Object
- #grep(*args) ⇒ Object
- #ignore(*paths) ⇒ Object
- #info(*args) ⇒ Object
- #init(db_dir = nil) ⇒ Object
- #list(*args) ⇒ Object
- #mcd ⇒ Object
- #plugins(*args) ⇒ Object
- #pwd ⇒ Object
- #rebuild(*args) ⇒ Object
- #remove(*args) ⇒ Object
- #rm(*args) ⇒ Object
- #setdb(*args) ⇒ Object
- #update(*args) ⇒ Object
- #web ⇒ Object
Instance Method Details
#add(*args) ⇒ Object
48 49 50 51 52 53 54 |
# File 'lib/milkode/cli.rb', line 48 def add(*args) if args.empty? && ![:from_file] CLI.task_help(shell, "add") else cdstk.add(args, ) end end |
#cleanup(*args) ⇒ Object
109 110 111 |
# File 'lib/milkode/cli.rb', line 109 def cleanup(*args) cdstk.cleanup(args, ) end |
#config(*args) ⇒ Object
244 245 246 |
# File 'lib/milkode/cli.rb', line 244 def config(*args) cdstk.config(args, ) end |
#dir(*args) ⇒ Object
127 128 129 |
# File 'lib/milkode/cli.rb', line 127 def dir(*args) cdstk.dir(args, ) end |
#dump ⇒ Object
121 122 123 |
# File 'lib/milkode/cli.rb', line 121 def dump cdstk.dump end |
#fav(*paths) ⇒ Object
171 172 173 |
# File 'lib/milkode/cli.rb', line 171 def fav(*paths) cdstk.fav(paths, ) end |
#files(*args) ⇒ Object
227 228 229 |
# File 'lib/milkode/cli.rb', line 227 def files(*args) cdstk.files(args, ) end |
#grep(*args) ⇒ Object
207 208 209 |
# File 'lib/milkode/cli.rb', line 207 def grep(*args) Milkode::CLI_Grep.execute($stdout, args) end |
#ignore(*paths) ⇒ Object
160 161 162 163 164 165 166 |
# File 'lib/milkode/cli.rb', line 160 def ignore(*paths) begin cdstk.ignore(paths, ) rescue IgnoreError => e $stdout.puts e. end end |
#info(*args) ⇒ Object
150 151 152 |
# File 'lib/milkode/cli.rb', line 150 def info(*args) cdstk.info(args_or_pipe(args, $stdin), ) end |
#init(db_dir = nil) ⇒ Object
17 18 19 20 21 |
# File 'lib/milkode/cli.rb', line 17 def init(db_dir = nil) db_dir = db_dir || Dbdir.default_dir FileUtils.mkdir_p db_dir cdstk(db_dir).init() end |
#list(*args) ⇒ Object
94 95 96 |
# File 'lib/milkode/cli.rb', line 94 def list(*args) cdstk.list(args, ) end |
#mcd ⇒ Object
139 140 141 |
# File 'lib/milkode/cli.rb', line 139 def mcd cdstk.mcd() end |
#plugins(*args) ⇒ Object
213 214 215 216 217 218 219 220 221 222 |
# File 'lib/milkode/cli.rb', line 213 def plugins(*args) $stdout.puts <<EOF bundle-milkode https://github.com/kou/bundle-milkode emacs-milkode https://github.com/ongaeshi/emacs-milkode gem-milkode https://github.com/kou/gem-milkode Gitomb https://github.com/tomykaira/gitomb Milkode_Sublime https://github.com/tsurushuu/Milkode_Sublime redmine_milkode https://github.com/suer/redmine_milkode EOF end |
#pwd ⇒ Object
100 101 102 |
# File 'lib/milkode/cli.rb', line 100 def pwd() cdstk.pwd() end |
#rebuild(*args) ⇒ Object
116 117 118 |
# File 'lib/milkode/cli.rb', line 116 def rebuild(*args) cdstk.rebuild(args, ) end |
#remove(*args) ⇒ Object
68 69 70 71 72 73 74 75 76 |
# File 'lib/milkode/cli.rb', line 68 def remove(*args) $stdout.puts "[warning] 'milk remove' is obsolate. Please use 'milk rm'." if args.empty? && ![:all] CLI.task_help(shell, "remove") else cdstk.remove(args, ) end end |
#rm(*args) ⇒ Object
82 83 84 85 86 87 88 |
# File 'lib/milkode/cli.rb', line 82 def rm(*args) if args.empty? && ![:all] CLI.task_help(shell, "remove") else cdstk.remove(args, ) end end |
#setdb(*args) ⇒ Object
133 134 135 |
# File 'lib/milkode/cli.rb', line 133 def setdb(*args) cdstk.setdb(args, ) end |
#update(*args) ⇒ Object
60 61 62 |
# File 'lib/milkode/cli.rb', line 60 def update(*args) cdstk.update(args, ) end |
#web ⇒ Object
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 |
# File 'lib/milkode/cli.rb', line 185 def web opts = { :environment => ENV['RACK_ENV'] || "development", :pid => nil, :Port => [:port], :Host => [:host], :AccessLog => [], :config => "config.ru", # ---------------------------- :server => [:server], :LaunchBrowser => ![:no_browser], :DbDir => [:db], :url => [:url], :gomilk => [:gomilk] } opts[:customize] = [:customize] # cdstk(opts[:DbDir]).assert_compatible Milkode::CLI_Cdweb.($stdout, opts) end |