require "thor" module Saber class CLI < Thor include Thor::Actions class_option "no-color", banner: "Disable colorization in output", type: :boolean class_option "verbose", aliases: "-V", banner: "Enable verbose output mode", type: :boolean class_option "log", banner: "Log file", type: :string class_option "force", aliases: "-f", banner: "Fore writing even if file exists", type: :boolean class_option "tracker", aliases: "-t", banner: "tracker name", type: :string attr_reader :o def initialize(*) super o = @o = options.dup Saber.ui = if o["log"] then require "logger" UI::Logger.new(::Logger.new(o["log"])) else the_shell = (options["no-color"] ? Thor::Shell::Basic.new : shell) UI::Shell.new(the_shell) end Saber.ui.debug! if o["verbose"] # Initialize environment in first time unless Rc.p.home.exists? Pa.mkdir Rc.p.home end end desc "clean", "clean up files doesn't in rtorrent client" def clean require "saber/task/clean" Task["clean"].invoke(:clean, [], o) end desc "server", "start saber-server daemon" def server AutoFetcher::Server.start end desc "client", "start saber-client daemon" def client AutoFetcher::Client.start end desc "drb_add [options]