Sha256: 83c7d5bc6f2bb6b32d1f0768d7ca14db7a8b4462364f93b68a348528389731a0

Contents?: true

Size: 1 KB

Versions: 5

Compression:

Stored size: 1 KB

Contents

module Scide

  module Commands

    # Edits a file with the default editor (<tt>$EDITOR</tt>).
    #
    # == Configuration Example
    #   # this YAML configuration,
    #   projects:
    #     project1:
    #       options:
    #         edit: '-c MyVimCommand'
    #       windows:
    #         - "window1 EDIT $HOME/fubar.txt"
    #
    #   # will produce the following command in window1:
    #   $EDITOR -c MyVimCommand $HOME/fubar.txt
    class Edit < Scide::Commands::Run

      # Returns a new edit command.
      #
      # See class definition for examples.
      #
      # == Arguments
      # * <tt>contents</tt> - The file to edit.
      # * <tt>options</tt> - Options that can be used in the contents
      #   of the command.
      #
      # == Options
      # * <tt>:edit => string</tt> - Arguments to the editor.
      def initialize contents, options = {}
        super contents, options
        @text = [ '$EDITOR', options[:edit].to_s, @text.to_s ].select(&:present?).join(' ')
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
scide-0.0.12 lib/scide/commands/edit.rb
scide-0.0.11 lib/scide/commands/edit.rb
scide-0.0.10 lib/scide/commands/edit.rb
scide-0.0.9 lib/scide/commands/edit.rb
scide-0.0.8 lib/scide/commands/edit.rb