Class: Lhj::Command

Inherits:
CLAide::Command
  • Object
show all
Defined in:
lib/lhj/command.rb,
lib/lhj/command/oss.rb,
lib/lhj/command/http.rb,
lib/lhj/command/init.rb,
lib/lhj/command/view.rb,
lib/lhj/command/yapi.rb,
lib/lhj/command/trans.rb,
lib/lhj/command/config.rb,
lib/lhj/command/oss/del.rb,
lib/lhj/command/oss/list.rb,
lib/lhj/command/template.rb,
lib/lhj/command/file_path.rb,
lib/lhj/command/oss/upload.rb,
lib/lhj/command/config/info.rb,
lib/lhj/command/head_import.rb,
lib/lhj/command/local/fetch.rb,
lib/lhj/command/local/local.rb,
lib/lhj/command/local/filter.rb,
lib/lhj/command/pgyer_upload.rb,
lib/lhj/command/rename_image.rb,
lib/lhj/command/sync_pod_repo.rb,
lib/lhj/command/reverse_import.rb,
lib/lhj/command/refactor_rename.rb,
lib/lhj/command/sync_pod_version.rb,
lib/lhj/command/duplicate_imageset.rb,
lib/lhj/command/local/local_upload.rb,
lib/lhj/command/local/micro_service.rb

Overview

command plugin

Defined Under Namespace

Classes: Config, DuplicateImageset, Fetch, Filepath, Filter, HeaderImport, Http, Init, Local, OSS, Pgyer, Refactor, RenameImage, ReverseImport, Service, SyncPod, SyncPodVersion, Trans, View, Yapi

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Command

Returns a new instance of Command.



48
49
50
51
# File 'lib/lhj/command.rb', line 48

def initialize(argv)
  super(argv)
  @spinner = TTY::Spinner.new('[:spinner]...', output: $stdout, format: :dots, clear: true)
end

Instance Method Details

#auto_spinObject



38
39
40
41
# File 'lib/lhj/command.rb', line 38

def auto_spin
  puts begin_title.green
  # @spinner.auto_spin
end

#begin_titleObject



34
35
36
# File 'lib/lhj/command.rb', line 34

def begin_title
  '开始处理...'
end

#handleObject



59
60
61
# File 'lib/lhj/command.rb', line 59

def handle
  raise 'A subclass should override the `Lhj::Command#run` method'
end

#runObject



53
54
55
56
57
# File 'lib/lhj/command.rb', line 53

def run
  auto_spin
  handle
  stop
end

#stopObject



43
44
45
46
# File 'lib/lhj/command.rb', line 43

def stop
  puts '处理完成'.green
  # @spinner.success('Done!')
end