Class: Milkode::CLI
- Inherits:
-
Thor
- Object
- Thor
- Milkode::CLI
- Defined in:
- lib/milkode/cli.rb
Class Method Summary collapse
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
Class Method Details
.exit_on_failure? ⇒ Boolean
11 12 13 |
# File 'lib/milkode/cli.rb', line 11 def self.exit_on_failure? true end |
Instance Method Details
#add(*args) ⇒ Object
52 53 54 55 56 57 58 |
# File 'lib/milkode/cli.rb', line 52 def add(*args) if args.empty? && ![:from_file] CLI.task_help(shell, "add") else cdstk.add(args, ) end end |
#cleanup(*args) ⇒ Object
113 114 115 |
# File 'lib/milkode/cli.rb', line 113 def cleanup(*args) cdstk.cleanup(args, ) end |
#config(*args) ⇒ Object
248 249 250 |
# File 'lib/milkode/cli.rb', line 248 def config(*args) cdstk.config(args, ) end |
#dir(*args) ⇒ Object
131 132 133 |
# File 'lib/milkode/cli.rb', line 131 def dir(*args) cdstk.dir(args, ) end |
#dump ⇒ Object
125 126 127 |
# File 'lib/milkode/cli.rb', line 125 def dump cdstk.dump end |
#fav(*paths) ⇒ Object
175 176 177 |
# File 'lib/milkode/cli.rb', line 175 def fav(*paths) cdstk.fav(paths, ) end |
#files(*args) ⇒ Object
231 232 233 |
# File 'lib/milkode/cli.rb', line 231 def files(*args) cdstk.files(args, ) end |
#grep(*args) ⇒ Object
211 212 213 |
# File 'lib/milkode/cli.rb', line 211 def grep(*args) Milkode::CLI_Grep.execute($stdout, args) end |
#ignore(*paths) ⇒ Object
164 165 166 167 168 169 170 |
# File 'lib/milkode/cli.rb', line 164 def ignore(*paths) begin cdstk.ignore(paths, ) rescue IgnoreError => e $stdout.puts e. end end |
#info(*args) ⇒ Object
154 155 156 |
# File 'lib/milkode/cli.rb', line 154 def info(*args) cdstk.info(args_or_pipe(args, $stdin), ) end |
#init(db_dir = nil) ⇒ Object
21 22 23 24 25 |
# File 'lib/milkode/cli.rb', line 21 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
98 99 100 |
# File 'lib/milkode/cli.rb', line 98 def list(*args) cdstk.list(args, ) end |
#mcd ⇒ Object
143 144 145 |
# File 'lib/milkode/cli.rb', line 143 def mcd cdstk.mcd() end |
#plugins(*args) ⇒ Object
217 218 219 220 221 222 223 224 225 226 |
# File 'lib/milkode/cli.rb', line 217 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
104 105 106 |
# File 'lib/milkode/cli.rb', line 104 def pwd() cdstk.pwd() end |
#rebuild(*args) ⇒ Object
120 121 122 |
# File 'lib/milkode/cli.rb', line 120 def rebuild(*args) cdstk.rebuild(args, ) end |
#remove(*args) ⇒ Object
72 73 74 75 76 77 78 79 80 |
# File 'lib/milkode/cli.rb', line 72 def remove(*args) $stdout.puts "[warning] 'milk remove' is obsolete. Please use 'milk rm'." if args.empty? && ![:all] CLI.task_help(shell, "remove") else cdstk.remove(args, ) end end |
#rm(*args) ⇒ Object
86 87 88 89 90 91 92 |
# File 'lib/milkode/cli.rb', line 86 def rm(*args) if args.empty? && ![:all] CLI.task_help(shell, "remove") else cdstk.remove(args, ) end end |
#setdb(*args) ⇒ Object
137 138 139 |
# File 'lib/milkode/cli.rb', line 137 def setdb(*args) cdstk.setdb(args, ) end |
#update(*args) ⇒ Object
64 65 66 |
# File 'lib/milkode/cli.rb', line 64 def update(*args) cdstk.update(args, ) end |
#web ⇒ Object
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 |
# File 'lib/milkode/cli.rb', line 189 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 |