Sha256: 54d905e644b9a548c02a0192701429d6b36befcc1a127f741ad1017e45493780

Contents?: true

Size: 981 Bytes

Versions: 2

Compression:

Stored size: 981 Bytes

Contents

module Scide

  module Commands
    
    # Tails a file.
    #
    # ==== Configuration Example
    #   # this YAML configuration,
    #   projects:
    #     project1:
    #       options:
    #         tail: '-n 1000'
    #       windows:
    #         - "window1 TAIL $HOME/fubar.txt"
    #
    #   # will produce the following command in window1:
    #   tail -n 1000 -f $HOME/fubar.txt
    class Tail < Scide::Commands::Run
      
      # Returns a new tail command.
      #
      # See class definition for examples.
      #
      # ==== Arguments
      # * <tt>contents</tt> - The file to tail.
      # * <tt>options</tt> - Options that can be used in the
      #   contents of the command.
      #
      # ==== Options
      # * <tt>tail => string</tt> - Arguments to tail.
      def initialize contents, options = {}
        super contents, options
        @text = [ 'tail', options[:tail].to_s, '-f', @text.to_s ].select(&:present?).join(' ')
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
scide-0.0.7 lib/scide/commands/tail.rb
scide-0.0.6 lib/scide/commands/tail.rb