Sha256: 3971a00d9c248285351703dc30864cb8f96ad65ac45aaddf7f7946b66e2f28e7

Contents?: true

Size: 813 Bytes

Versions: 1

Compression:

Stored size: 813 Bytes

Contents

# frozen_string_literal: true

require 'thor'

module Sftui
  # Handle the application command line parsing
  # and the dispatch to various command objects
  #
  # @api public
  class CLI < Thor
    # Error raised by this runner
    Error = Class.new(StandardError)

    desc 'version', 'sftui version'
    def version
      require_relative 'version'
      puts "v#{Sftui::VERSION}"
    end
    map %w(--version -v) => :version

    desc 'stream UART', 'Command description...'
    method_option :help, aliases: '-h', type: :boolean,
                         desc: 'Display usage information'
    def stream(uart)
      if options[:help]
        invoke :help, ['stream']
      else
        require_relative 'commands/stream'
        Sftui::Commands::Stream.new(uart, options).execute
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sftui-0.1.0 lib/sftui/cli.rb