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/yapi.rb,
lib/lhj/command/trans.rb,
lib/lhj/command/config.rb,
lib/lhj/command/oss/del.rb,
lib/lhj/command/oss/info.rb,
lib/lhj/command/oss/list.rb,
lib/lhj/command/template.rb,
lib/lhj/command/code/view.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/oss/download.rb,
lib/lhj/command/pgyer_upload.rb,
lib/lhj/command/rename_image.rb,
lib/lhj/command/sync_pod_code.rb,
lib/lhj/command/sync_pod_repo.rb,
lib/lhj/command/reverse_import.rb,
lib/lhj/command/yapi/yapi_init.rb,
lib/lhj/command/oss/list_bucket.rb,
lib/lhj/command/refactor_rename.rb,
lib/lhj/command/sync_pod_version.rb,
lib/lhj/command/oss/update_bucket.rb,
lib/lhj/command/code/code_template.rb,
lib/lhj/command/duplicate_imageset.rb,
lib/lhj/command/local/local_upload.rb,
lib/lhj/command/sync_dingding_user.rb,
lib/lhj/command/local/micro_service.rb,
lib/lhj/command/jenkins/jenkins_build.rb

Overview

command plugin

Defined Under Namespace

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

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Command

Returns a new instance of Command.



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

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

Instance Method Details

#auto_spinObject



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

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

#begin_titleObject



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

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

#handleObject



69
70
71
# File 'lib/lhj/command.rb', line 69

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

#runObject



63
64
65
66
67
# File 'lib/lhj/command.rb', line 63

def run
  auto_spin
  handle
  stop
end

#stopObject



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

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