Class: Lhj::Command
- Inherits:
-
CLAide::Command
- Object
- CLAide::Command
- Lhj::Command
- 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/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/local/local_upload.rb,
lib/lhj/command/local/micro_service.rb
Overview
command plugin
Direct Known Subclasses
Config, Fetch, Filepath, Filter, HeaderImport, Http, Init, Local, OSS, Refactor, RenameImage, ReverseImport, Service, SyncPod, Trans, View, Yapi
Defined Under Namespace
Classes: Config, Fetch, Filepath, Filter, HeaderImport, Http, Init, Local, OSS, Refactor, RenameImage, ReverseImport, Service, SyncPod, Trans, View, Yapi
Instance Method Summary collapse
- #auto_spin ⇒ Object
- #handle ⇒ Object
-
#initialize(argv) ⇒ Command
constructor
A new instance of Command.
- #run ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(argv) ⇒ Command
Returns a new instance of Command.
43 44 45 46 |
# File 'lib/lhj/command.rb', line 43 def initialize(argv) super(argv) @spinner = TTY::Spinner.new('...', output: $stdout, format: :dots, clear: true) end |
Instance Method Details
#auto_spin ⇒ Object
33 34 35 36 |
# File 'lib/lhj/command.rb', line 33 def auto_spin print "正在处理...\n".green # @spinner.auto_spin end |
#handle ⇒ Object
54 55 56 |
# File 'lib/lhj/command.rb', line 54 def handle raise 'A subclass should override the `Lhj::Command#run` method' end |
#run ⇒ Object
48 49 50 51 52 |
# File 'lib/lhj/command.rb', line 48 def run auto_spin handle stop end |
#stop ⇒ Object
38 39 40 41 |
# File 'lib/lhj/command.rb', line 38 def stop print '处理完成'.green # @spinner.success('Done!') end |