Skip to content

Commit

Permalink
Specify path relative to project root to send file to
Browse files Browse the repository at this point in the history
  • Loading branch information
bobheadxi committed Jun 23, 2018
1 parent 11849e5 commit b1621cc
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ Run 'inertia [REMOTE] init' to gather this information.`,
cmd.AddCommand(ssh)

send := deepCopy(cmdDeploymentSendFile)
send.Flags().StringP("dest", "d", "", "Path relative from project root to send file to")
send.Flags().StringP("permissions", "p", "0655", "Permissions settings for file")
cmd.AddCommand(send)

Expand Down Expand Up @@ -372,9 +373,15 @@ deployment. Provide a relative path to your file.`,
log.Fatal(err.Error())
}

// Get flag for destination
dest, err := cmd.Flags().GetString("dest")
if err != nil {
log.Fatal(err.Error())
}

// Destination path - todo: allow config
projectPath := "/app/host/inertia/project"
remotePath := path.Join(projectPath, args[0])
remotePath := path.Join(projectPath, dest, args[0])

// Initiate copy
session := client.NewSSHRunner(deployment.RemoteVPS)
Expand All @@ -383,7 +390,7 @@ deployment. Provide a relative path to your file.`,
log.Fatal(err.Error())
}

fmt.Println("File", args[0], "has been copied to", projectPath, "on remote", remoteName)
fmt.Println("File", args[0], "has been copied to", remotePath, "on remote", remoteName)
},
}

Expand Down

0 comments on commit b1621cc

Please sign in to comment.