Sha256: ac32112c79024c595620bd4b512cf25f156d6a577fcacf167a9ec0de0cc1d5bd

Contents?: true

Size: 1.19 KB

Versions: 6

Compression:

Stored size: 1.19 KB

Contents

# frozen_string_literal: true

require_relative "new_command"
require_relative "run_command"
require_relative "teleport_command"
require_relative "version_command"
require_relative "record_command"

module Superbot
  module CLI
    class RootCommand < Clamp::Command
      banner "superbot 🤖"

      option ['-v', '--version'], :flag, "Show version information" do
        puts Superbot::VERSION
        exit(0)
      end

      subcommand ["version"], "Show version information", VersionCommand
      subcommand ["teleport"], "Open a teleport for superbots", TeleportCommand
      subcommand ["record"], "Open browser with selenium ide pre-loaded", RecordCommand if ENV['SUPERBOT_FEAT_RECORD'] == 'true'
      if ENV['SUPERBOT_FEAT_PROJECT'] == 'true'
        subcommand ["new"], "Create a new project", NewCommand
        subcommand ["run"], "Run a project", RunCommand
      end

      def self.run
        super
      rescue StandardError => exc
        warn exc.message
        warn exc.backtrace.join("\n")
      end

      def subcommand_missing(name)
        return super unless name == 'local'

        abort "Subcommand '#{name}' requires gem superbot-#{name} to be installed"
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
superbot-0.1.25 lib/superbot/cli/root_command.rb
superbot-0.1.24 lib/superbot/cli/root_command.rb
superbot-0.1.23 lib/superbot/cli/root_command.rb
superbot-0.1.22 lib/superbot/cli/root_command.rb
superbot-0.1.21 lib/superbot/cli/root_command.rb
superbot-0.1.20 lib/superbot/cli/root_command.rb