Skip to content

Commit

Permalink
Merge pull request #304 from steved/master
Browse files Browse the repository at this point in the history
Formatters::Pretty: display command being run
  • Loading branch information
leehambley committed Dec 18, 2015
2 parents ef1186e + 4535179 commit 025392a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Expand Up @@ -10,6 +10,9 @@ appear at the top.
* make sure working directory for commands is properly cleared after `within` blocks
[PR #307](https://github.com/capistrano/sshkit/pull/307)
@steved
* display more accurate string for commands with spaces being output in `Formatter::Pretty`
[PR #304](https://github.com/capistrano/sshkit/pull/304)
@steved

## 1.8.1

Expand Down
6 changes: 5 additions & 1 deletion lib/sshkit/command.rb
Expand Up @@ -206,7 +206,11 @@ def to_command
end

def to_s
[SSHKit.config.command_map[command.to_sym], *Array(args)].join(' ')
if should_map?
[SSHKit.config.command_map[command.to_sym], *Array(args)].join(' ')
else
command.to_s
end
end

private
Expand Down
8 changes: 4 additions & 4 deletions test/unit/backends/test_printer.rb
Expand Up @@ -22,7 +22,7 @@ def printer
def test_execute
printer.execute 'uname -a'
assert_output_lines(
' INFO [aaaaaa] Running /usr/bin/env uname -a on example.com',
' INFO [aaaaaa] Running uname -a on example.com',
' DEBUG [aaaaaa] Command: uname -a'
)
end
Expand All @@ -31,7 +31,7 @@ def test_test_method
printer.test '[ -d /some/file ]'

assert_output_lines(
' DEBUG [aaaaaa] Running /usr/bin/env [ -d /some/file ] on example.com',
' DEBUG [aaaaaa] Running [ -d /some/file ] on example.com',
' DEBUG [aaaaaa] Command: [ -d /some/file ]'
)
end
Expand All @@ -42,7 +42,7 @@ def test_capture
assert_equal '', result

assert_output_lines(
' DEBUG [aaaaaa] Running /usr/bin/env ls -l on example.com',
' DEBUG [aaaaaa] Running ls -l on example.com',
' DEBUG [aaaaaa] Command: ls -l'
)
end
Expand Down Expand Up @@ -70,4 +70,4 @@ def assert_output_lines(*expected_lines)
end
end
end
end
end

0 comments on commit 025392a

Please sign in to comment.