Module: MJ::Tools

Defined in:
lib/mj/tools/ssh.rb,
lib/mj/tools/editor.rb,
lib/mj/tools/subprocess.rb

Defined Under Namespace

Modules: SubProcess Classes: SSH, TmpFileEditor

Constant Summary collapse

@@editor =
nil

Class Method Summary collapse

Class Method Details

.editorObject

Look for a suitable editor in the users environment.

We check

  1. $VISUAL (if $DISPLAY is set)

  2. $GUIEDITOR (if $DISPLAY is set)

  3. $EDITOR

  4. Giving up

The result is cached.



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/mj/tools/editor.rb', line 18

def Tools.editor()
    return @@editor if @@editor
    logger.debug( 'Looking for a editor.' )

    if ENV.include?( 'DISPLAY' )
        logger.debug( 'Checking $VISUAL' )
        return @@editor = ENV['VISUAL'] if ENV.include?( 'VISUAL' )
        logger.debug( 'Checking $GUIEDITOR' )
        return @@editor = ENV['GUIEDITOR'] if ENV.include?( 'GUIEDITOR' )
    end
    logger.debug( 'Checking $EDITOR' )
    return @@editor = ENV['EDITOR'] if ENV.include?( 'EDITOR' )
end