lib/lhj/command.rb in lhj-tools-0.1.6 vs lib/lhj/command.rb in lhj-tools-0.1.7

- old
+ new

@@ -1,12 +1,15 @@ require 'claide' require "tty-spinner" +require 'lhj/action/sh_helper' +require 'lhj/ui/ui' module Lhj # command plugin class Command < CLAide::Command require 'lhj/command/init' + require 'lhj/command/config' require 'lhj/command/head_import' require 'lhj/command/refactor_rename' require 'lhj/command/local/fetch' require 'lhj/command/local/filter' require 'lhj/command/local/local' @@ -18,24 +21,39 @@ require 'lhj/command/oss/list' require 'lhj/command/view' require 'lhj/command/rename_image' require 'lhj/command/trans' require 'lhj/command/yapi' + require 'lhj/command/file_path' + require 'lhj/command/http' + require 'lhj/command/sync_pod_repo' self.abstract_command = true self.command = 'lhj' - def spinner - @spinner ||= TTY::Spinner.new('[:spinner]正在处理...', output: $stdout, format: :dots) - end - def auto_spin - spinner.auto_spin - puts "\n" + print "正在处理...\n".green + # @spinner.auto_spin end def stop - spinner.stop('Done!') + print '处理完成'.green + # @spinner.success('Done!') + end + + def initialize(argv) + super(argv) + @spinner = TTY::Spinner.new('...', output: $stdout, format: :dots, clear: true) + end + + def run + auto_spin + handle + stop + end + + def handle + raise 'A subclass should override the `Lhj::Command#run` method' end end end