Skip to content

Commit

Permalink
ssh: cd to site's directory
Browse files Browse the repository at this point in the history
  • Loading branch information
zippoxer committed Jun 17, 2018
1 parent c069e87 commit afb5d70
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,21 @@ func main() {
log.Fatal(err)
}
case appSSH.FullCommand():
server, _, err := george.Search(*appSSHTarget)
server, site, err := george.Search(*appSSHTarget)
if err != nil {
log.Fatal(err)
}
err = george.SSHInstallKey(server.Id)
if err != nil {
log.Fatal(err)
}
cmd := exec.Command("ssh", "forge@"+server.IPAddress)
var flags, args []string
args = append(args, "forge@"+server.IPAddress)
if site != nil {
flags = append(flags, "-t")
args = append(args, fmt.Sprintf("cd %q; bash -l", site.Name))
}
cmd := exec.Command("ssh", append(flags, args...)...)
cmd.Stdin = os.Stdin
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
Expand Down

0 comments on commit afb5d70

Please sign in to comment.