Sha256: 038bb90467d6ab6a9f15fe7091bbc0e775cf5c104d632998cb54a9aef43698a1
Contents?: true
Size: 887 Bytes
Versions: 21
Compression:
Stored size: 887 Bytes
Contents
# lib/aia/tools/editor.rb # This is the default editor setup in the # system environment variable EDITOR class AIA::Editor < AIA::Tools meta( name: 'editor', role: :editor, desc: "Your default system $EDITOR", url: "unknown", install: "should already be installed", ) DEFAULT_PARAMETERS = "" attr_accessor :command def initialize(file: "") @file = file discover_editor build_command end def discover_editor editor = ENV['EDITOR'] # This might be nil if editor.nil? @name = "echo" @description = "You have no default editor" @install = "Set your system environment variable EDITOR" else @name = editor end end def build_command @command = "#{meta.name} #{DEFAULT_PARAMETERS} #{@file}" end def run `#{command}` end end
Version data entries
21 entries across 21 versions & 1 rubygems