Skip to content

Commit

Permalink
fix project status bug, version bump
Browse files Browse the repository at this point in the history
  • Loading branch information
aschmidt75 committed Apr 12, 2017
1 parent c157c6a commit e865cec
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
22 changes: 11 additions & 11 deletions jobs.go
Expand Up @@ -183,26 +183,26 @@ func postNewJob(kind, name string) *Job {
}

func jobStatusProject(cmd *cli.Cmd) {
cmd.Spec = "[--project] | [--all]"
cmd.Spec = "[--project]"
name := cmd.StringOpt("project p", "", "Name (or part of it) of a project")
all := cmd.BoolOpt("all a", false, "Fetch details of all your jobs (do not combine with -p)")

cmd.Action = func() {
*name = strings.TrimSpace(*name)
// if project name not given, try to read project lock file
if *name == "" {
*name, _ = ReadProjectLock()
}
if *all || *name == "" {
_, err := chooseJob("/v1/jobs", false, "")
ReportError("Choosing the job", err)
var p *Project
var err error
// still no project known? We need to ask user for specific project
if *name == "" {
p, err = chooseProject(*name, "Which project's jobs would you like to see: ")
if p == nil || err != nil {
ReportError("Choosing the project", err)
return
}
}

// first get the project, then get the pid, and make the call.
p, err := chooseProject(*name, "Which project's jobs would you like to see: ")
if err != nil {
ReportError("Choosing the project", err)
return
}
job, err := chooseJob(p.JobsUrl(), true, "Select a job id to show more details: ")
if err != nil {
ReportError("Selecting the job", err)
Expand Down
2 changes: 1 addition & 1 deletion main.go
Expand Up @@ -25,7 +25,7 @@ import (
"github.com/op/go-logging"
)

var VERSION = "0.3.2"
var VERSION = "0.3.3"

var BackendBaseUrl = os.Getenv("SLYFTBACKEND")

Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "slyft",
"version": "0.3.2",
"version": "0.3.3",
"description": "Command line client to slyft-server",
"main": "main.go",
"scripts": {
Expand Down
2 changes: 2 additions & 0 deletions projects.go
Expand Up @@ -290,11 +290,13 @@ func listProjects(cmd *cli.Cmd) {
func chooseProject(portion, message string) (*Project, error) {
resp, err := FindProjects(portion)
if err != nil {
Log.Debugf("chooseProject: err=%s", err)
return nil, err
}
defer resp.Body.Close()
projects, err := extractProjectFromResponse(resp, http.StatusOK, true)
if err != nil {
Log.Debugf("chooseProject: err=%s", err)
return nil, err
}

Expand Down

0 comments on commit e865cec

Please sign in to comment.