Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Naive implementation of {remote, Endpoint, Shell}

  • Loading branch information...
commit 5257bf0a8d320669b3a8b36e062f5b51f5a4447d 1 parent 4549bad
Yurii Rashkovskii authored
View
7 apps/htoad/include/stdlib.hrl
@@ -65,3 +65,10 @@
fact :: tuple(),
reason :: term()
}).
+
+-record(endpoint,
+ {
+ type = ssh :: ssh,
+ hostname :: string(),
+ username :: undefined | string()
+ }).
View
1  apps/htoad/src/htoad.app.src
@@ -33,6 +33,7 @@
htoad_pkg_apt,
htoad_io,
htoad_shell,
+ htoad_ssh,
htoad_error,
htoad_users
]}
View
14 apps/htoad/src/htoad_ssh.erl
@@ -0,0 +1,14 @@
+-module(htoad_ssh).
+-include_lib("htoad/include/htoad.hrl").
+-include_lib("htoad/include/toadie.hrl").
+-include_lib("htoad/include/stdlib.hrl").
+
+-rules([remote_ssh_command]).
+
+remote_ssh_command(Engine, {remote, #endpoint{
+ type = ssh,
+ hostname = Host,
+ username = Username
+ }, #shell{ cmd = Cmd }}) ->
+ Hostname = (case Username of undefined -> ""; _ -> Username ++ "@" end) ++ Host,
+ htoad:assert(Engine,#shell{ cmd = "ssh " ++ Hostname ++ " " ++ Cmd }).

0 comments on commit 5257bf0

Please sign in to comment.
Something went wrong with that request. Please try again.