Sha256: d98f907a9607a457a9ad187126c5079d4ddbab33c226bc038cbb53ad77a14a62

Contents?: true

Size: 521 Bytes

Versions: 2

Compression:

Stored size: 521 Bytes

Contents

module MyScripts
  class CLI

    attr_accessor :stdout, :stdin

    def self.run( script_name, argv )
      new.run script_name, argv
    end

    def initialize( stdin=$stdin, stdout=$stdout )
      @stdin = stdin
      @stdout = stdout
    end

    def run( script_name, argv )
      script = "MyScripts::#{script_name.capitalize}".to_class
      script.new(script_name, argv, self).run
    rescue => e
      @stdout.puts e.backtrace
      @stdout.puts e.message
      exit 1
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
my_scripts-0.0.7 lib/my_scripts/cli.rb
my_scripts-0.0.6 lib/my_scripts/cli.rb