Land #9095, default PromptTimeFormat (%T)
commit
60a7a80ff0
|
@ -42,7 +42,7 @@ module Shell
|
||||||
# Set the stop flag to false
|
# Set the stop flag to false
|
||||||
self.stop_flag = false
|
self.stop_flag = false
|
||||||
self.disable_output = false
|
self.disable_output = false
|
||||||
self.stop_count = 0
|
self.stop_count = 0
|
||||||
|
|
||||||
# Initialize the prompt
|
# Initialize the prompt
|
||||||
self.init_prompt = prompt
|
self.init_prompt = prompt
|
||||||
|
@ -132,9 +132,10 @@ module Shell
|
||||||
if framework
|
if framework
|
||||||
if input.prompt.include?("%T")
|
if input.prompt.include?("%T")
|
||||||
t = Time.now
|
t = Time.now
|
||||||
if framework.datastore['PromptTimeFormat']
|
# This %T is the strftime shorthand for %H:%M:%S
|
||||||
t = t.strftime(framework.datastore['PromptTimeFormat'])
|
format = framework.datastore['PromptTimeFormat'] || "%T"
|
||||||
end
|
t = t.strftime(format)
|
||||||
|
# This %T is the marker in the prompt where we need to place the time
|
||||||
input.prompt.gsub!(/%T/, t.to_s)
|
input.prompt.gsub!(/%T/, t.to_s)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue