Skip to content

Commit 025392a

Browse files
committed
Merge pull request #304 from steved/master
Formatters::Pretty: display command being run
2 parents ef1186e + 4535179 commit 025392a

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ appear at the top.
1010
* make sure working directory for commands is properly cleared after `within` blocks
1111
[PR #307](https://github.com/capistrano/sshkit/pull/307)
1212
@steved
13+
* display more accurate string for commands with spaces being output in `Formatter::Pretty`
14+
[PR #304](https://github.com/capistrano/sshkit/pull/304)
15+
@steved
1316

1417
## 1.8.1
1518

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)