Sha256: 2b91a5b6fadadf030c10467d36ace597f9f2e15aac225a8c053cf2ca2819983c

Contents?: true

Size: 1.48 KB

Versions: 3

Compression:

Stored size: 1.48 KB

Contents

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'
    require 'lhj/command/local/micro_service'
    require 'lhj/command/local/local_upload'
    require 'lhj/command/oss'
    require 'lhj/command/oss/del'
    require 'lhj/command/oss/upload'
    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'
    require 'lhj/command/pgyer_upload'

    self.abstract_command = true
    self.command = 'lhj'

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

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

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

    def initialize(argv)
      super(argv)
      @spinner = TTY::Spinner.new('[:spinner]...', 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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lhj-tools-0.1.18 lib/lhj/command.rb
lhj-tools-0.1.17 lib/lhj/command.rb
lhj-tools-0.1.16 lib/lhj/command.rb