Skip to content
This repository has been archived by the owner on May 8, 2023. It is now read-only.

Commit

Permalink
When git repo is present, add VSCode task to push to GitHub
Browse files Browse the repository at this point in the history
Fixes #89
  • Loading branch information
pieterclaerhout committed Jan 31, 2020
1 parent 4d64098 commit 84b7c56
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion internal/creator/creator.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ func (creator Creator) createConfig(project common.Project, cfg config.Config) e

func (creator Creator) createTasks(project common.Project, cfg config.Config) error {

tasks := newVisualStudioCodeTaskList(cfg)
tasks := newVisualStudioCodeTaskList(cfg, creator.CreateGitRepo)

tasksPath := project.RelPath(visualStudioDirName, visualStudioCodeTasksFileName)
return creator.WriteJSONFileIfNotExists(tasksPath, tasks)
Expand Down
7 changes: 6 additions & 1 deletion internal/creator/vscode_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type visualStudioCodeTasks struct {
Tasks []visualStudioCodeTask `json:"tasks"`
}

func newVisualStudioCodeTaskList(cfg config.Config) *visualStudioCodeTasks {
func newVisualStudioCodeTaskList(cfg config.Config, createGitRepo bool) *visualStudioCodeTasks {
result := &visualStudioCodeTasks{
Version: "2.0.0",
Tasks: []visualStudioCodeTask{
Expand All @@ -45,5 +45,10 @@ func newVisualStudioCodeTaskList(cfg config.Config) *visualStudioCodeTasks {
newVisualStudioCodeTask(cfg, "run (debug)", "DEBUG=1 go-james run"),
},
}
if createGitRepo == true {
result.Tasks = append(result.Tasks,
newVisualStudioCodeTask(cfg, "push to github", "git push --set-upstream origin"),
)
}
return result
}

0 comments on commit 84b7c56

Please sign in to comment.