Added exec command to homesick.

This commit is contained in:
Jeremy Cook
2014-04-01 22:31:50 -04:00
parent 8b6bf92e9a
commit bea3a0b680
2 changed files with 57 additions and 4 deletions

View File

@@ -277,6 +277,25 @@ class Homesick < Thor
end
end
desc 'exec CASTLE COMMAND',
'Execute a single shell command inside the root of a castle'
def exec(castle, *args)
check_castle_existance castle, 'exec'
unless args.count > 0
say_status :error,
'You must pass a shell command to execute',
:red
exit(1)
end
full_command = args.join(' ')
say_status "exec '#{full_command}'",
"Executing command '#{full_command}' in castle '#{castle}'",
:green
inside repos_dir.join(castle) do
system(full_command)
end
end
desc 'version', 'Display the current version of homesick'
def version
say Homesick::Version::STRING