Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

Commit

Permalink
Add project name to project link list output (#495)
Browse files Browse the repository at this point in the history
* Add project name to link get output
* Add url to human readable output

Signed-off-by: James Wallis <[email protected]>
  • Loading branch information
James Wallis authored Jun 15, 2020
1 parent f548c88 commit 9fb96a2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions pkg/actions/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,9 @@ func ProjectLinkList(c *cli.Context) {
} else {
w := new(tabwriter.Writer)
w.Init(os.Stdout, 0, 8, 2, '\t', 0)
fmt.Fprintln(w, "ENVIRONMENT VARIABLE \tPROJECT ID")
fmt.Fprintln(w, "TARGET PROJECT \tENVIRONMENT VARIABLE \t TARGET URL")
for _, project := range links {
fmt.Fprintln(w, project.EnvName+"\t"+project.ProjectID)
fmt.Fprintln(w, project.ProjectName+"\t"+project.EnvName+"\t"+project.ProjectURL)
}
fmt.Fprintln(w)
w.Flush()
Expand Down
7 changes: 4 additions & 3 deletions pkg/project/link.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ import (
type (
// Link : The structure of a Link object returned from PFE
Link struct {
ProjectID string `json:"projectID"`
EnvName string `json:"envName"`
ProjectURL string `json:"projectURL"`
ProjectID string `json:"projectID"`
ProjectName string `json:"projectName"`
EnvName string `json:"envName"`
ProjectURL string `json:"projectURL"`
}
// LinkParameters : The request structure to create a link
LinkParameters struct {
Expand Down
4 changes: 2 additions & 2 deletions pkg/project/link_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ func TestGetProjectLinks(t *testing.T) {
t.Run("Expect success - project links should be returned", func(t *testing.T) {
// construct mock response body and status code
links := []Link{
Link{ProjectID: "1234", ProjectURL: "URL1", EnvName: "ENV1"},
Link{ProjectID: "9999", ProjectURL: "URL2", EnvName: "ENV2"},
Link{ProjectID: "1234", ProjectName: "name1", ProjectURL: "URL1", EnvName: "ENV1"},
Link{ProjectID: "9999", ProjectName: "name2", ProjectURL: "URL2", EnvName: "ENV2"},
}
jsonResponse, _ := json.Marshal(links)
body := ioutil.NopCloser(bytes.NewReader([]byte(jsonResponse)))
Expand Down

0 comments on commit 9fb96a2

Please sign in to comment.