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
# * contents - The file to tail.
# * options - Options that can be used in the
# contents of the command.
#
# == Options
# * tail => string - 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