Skip to content

Commit a62a987

Browse files
committed
Formatters::Pretty: display command being run for unmapped commands
1 parent ef1186e commit a62a987

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

lib/sshkit/command.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,11 @@ def to_command
206206
end
207207

208208
def to_s
209-
[SSHKit.config.command_map[command.to_sym], *Array(args)].join(' ')
209+
if should_map?
210+
[SSHKit.config.command_map[command.to_sym], *Array(args)].join(' ')
211+
else
212+
command.to_s
213+
end
210214
end
211215

212216
private

test/unit/backends/test_printer.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def printer
2222
def test_execute
2323
printer.execute 'uname -a'
2424
assert_output_lines(
25-
' INFO [aaaaaa] Running /usr/bin/env uname -a on example.com',
25+
' INFO [aaaaaa] Running uname -a on example.com',
2626
' DEBUG [aaaaaa] Command: uname -a'
2727
)
2828
end
@@ -31,7 +31,7 @@ def test_test_method
3131
printer.test '[ -d /some/file ]'
3232

3333
assert_output_lines(
34-
' DEBUG [aaaaaa] Running /usr/bin/env [ -d /some/file ] on example.com',
34+
' DEBUG [aaaaaa] Running [ -d /some/file ] on example.com',
3535
' DEBUG [aaaaaa] Command: [ -d /some/file ]'
3636
)
3737
end
@@ -42,7 +42,7 @@ def test_capture
4242
assert_equal '', result
4343

4444
assert_output_lines(
45-
' DEBUG [aaaaaa] Running /usr/bin/env ls -l on example.com',
45+
' DEBUG [aaaaaa] Running ls -l on example.com',
4646
' DEBUG [aaaaaa] Command: ls -l'
4747
)
4848
end
@@ -70,4 +70,4 @@ def assert_output_lines(*expected_lines)
7070
end
7171
end
7272
end
73-
end
73+
end

0 commit comments

Comments
 (0)