Sha256: f53d27e1a914057ebee51063d9c7dff578ba49e62d2f55e0e12db9dd47674e94

Contents?: true

Size: 1.01 KB

Versions: 2

Compression:

Stored size: 1.01 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

2 entries across 2 versions & 1 rubygems

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