Skip to content

Commit af42f51

Browse files
committed
Default PromptTimeFormat to %T
1 parent 7e338fd commit af42f51

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lib/rex/ui/text/shell.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def initialize(prompt, prompt_char = '>', histfile = nil, framework = nil)
4242
# Set the stop flag to false
4343
self.stop_flag = false
4444
self.disable_output = false
45-
self.stop_count = 0
45+
self.stop_count = 0
4646

4747
# Initialize the prompt
4848
self.init_prompt = prompt
@@ -132,9 +132,10 @@ def run(&block)
132132
if framework
133133
if input.prompt.include?("%T")
134134
t = Time.now
135-
if framework.datastore['PromptTimeFormat']
136-
t = t.strftime(framework.datastore['PromptTimeFormat'])
137-
end
135+
# This %T is the strftime shorthand for %H:%M:%S
136+
format = framework.datastore['PromptTimeFormat'] || "%T"
137+
t = t.strftime(format)
138+
# This %T is the marker in the prompt where we need to place the time
138139
input.prompt.gsub!(/%T/, t.to_s)
139140
end
140141

0 commit comments

Comments
 (0)