Module: Shellfuncs

Defined in:
lib/shellfuncs.rb

Instance Method Summary collapse

Instance Method Details

#commandRun(cmd) ⇒ Object

Runs the command from the command line and pushes it onto the stack



48
49
50
51
52
53
54
55
# File 'lib/shellfuncs.rb', line 48

def commandRun( cmd )
	if $DEBUG
		puts "DEBUGGING VALUES: cmd: " + cmd.join(" ") + " at Line #{__LINE__} in #{__FILE__}"
	end

	system( "#{cmd.join(' ')}" )
	History.histAdd( "#{cmd.join(' ')}" )
end

#envUpdateObject

Updates Environment Variables and the prompt



24
25
26
27
28
29
30
31
# File 'lib/shellfuncs.rb', line 24

def envUpdate
	$cwd = Dir.pwd
	$prompt = $cwd + "> "

	if $DEBUG
		puts "DEBUGGING VALUES: CWD: " + $cwd + " PROMPT: " + $prompt + " at Line #{__LINE__} in #{__FILE__}"
	end
end

#inPath(cmd) ⇒ Object

Checks cmd to see if its in the PATH



34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/shellfuncs.rb', line 34

def inPath( cmd )
	if $DEBUG
		puts "DEBUGGING VALUES: cmd: " + cmd + " at Line #{__LINE__} in #{__FILE__}"
	end

	$path.each do | dir | ## For every entry in the PATH
		if File.exist?( dir + "/" + cmd )
			return true
		end
	end
	return false
end

#promptPrintObject

Prints out the prompt



19
20
21
# File 'lib/shellfuncs.rb', line 19

def promptPrint
	print "#{$prompt}".chomp
end