Sha256: 3768489afd059b4276f878588d8ad39adbee1dfa54774661e9cb6888f6d2ee5f

Contents?: true

Size: 1.48 KB

Versions: 3

Compression:

Stored size: 1.48 KB

Contents

# frozen_string_literal: true
require 'thor'

module Ragent
  module Cli
    class Main < ::Thor
      desc 'start', 'starts the ragent framweork reading your config.ragent file'
      option :log_level, banner: '<debug|info|warn|error|fatal> overrides ENV RAGENT_LOG_LEVEL'
      option :root, banner: '<DIR> the root of the app (default is the pwd)'
      def start
        Ragent.start(workdir: options[:root],
                     log_level: options[:log_level],
                     blocking: true)
      end

      long_desc <<-LONGDESC
ragent console will start an irb console in your terminal. CAUTION when exiting the console
currently the agent won't shutdown cleanly.
LONGDESC
      desc 'console', 'start your application but gives you a console'
      option :log_level, banner: '<debug|info|warn|error|fatal> overrides ENV RAGENT_LOG_LEVEL'
      option :root, banner: '<DIR> the root of the app (default is the pwd)'
      def console
        Ragent.start(workdir: options[:root],
                     log_level: options[:log_level],
                     blocking: false)
        require 'irb'
        ARGV.clear # see http://stackoverflow.com/questions/33070092/irb-start-not-starting
        IRB.start
      end

      # def plugin
      #  puts "TBD: create a new plugin structure"
      # end

      # def new
      #  puts "TBD: create a new ragent app"
      # end

      desc 'version', 'prints version of metoda-cli'
      def version
        puts Ragent::VERSION.to_s
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ragent-0.0.6 lib/ragent/cli.rb
ragent-0.0.5 lib/ragent/cli.rb
ragent-0.0.4 lib/ragent/cli.rb