Skip to content
This repository has been archived by the owner on Sep 9, 2020. It is now read-only.

Commit

Permalink
fix(status): fix Constraint & Version output
Browse files Browse the repository at this point in the history
Replace `Constraint` & `Version` with their json alternative forms
`JSONConstraint` and `JSONVersion`.
  • Loading branch information
darkowlzz committed Aug 8, 2017
1 parent 11758a7 commit 53a432e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
23 changes: 16 additions & 7 deletions cmd/dep/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,13 @@ func (out *jsonOutput) BasicFooter() {
}

func (out *jsonOutput) BasicLine(bs *BasicStatus) {
if v, ok := bs.Constraint.(gps.Version); ok {
bs.JSONConstraint = formatVersion(v)
} else {
bs.JSONConstraint = bs.Constraint.String()
}

bs.JSONVersion = formatVersion(bs.Version)
out.basic = append(out.basic, bs)
}

Expand Down Expand Up @@ -243,13 +250,15 @@ func (cmd *statusCommand) Run(ctx *dep.Ctx, args []string) error {
// BasicStatus contains all the information reported about a single dependency
// in the summary/list status output mode.
type BasicStatus struct {
ProjectRoot string
Children []string
Constraint gps.Constraint
Version gps.UnpairedVersion
Revision gps.Revision
Latest gps.Version
PackageCount int
ProjectRoot string
Children []string
Constraint gps.Constraint `json:"-"`
Version gps.UnpairedVersion `json:"-"`
Revision gps.Revision
Latest gps.Version
PackageCount int
JSONConstraint string `json:"Constraint"`
JSONVersion string `json:"Version"`
}

// MissingStatus contains information about all the missing packages in a project.
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"ProjectRoot":"github.com/sdboyer/deptest","Children":null,"Constraint":{},"Version":{},"Revision":"ff2948a2ac8f538c4ecd55962e919d1e13e74baf","Latest":"3f4c3bea144e112a69bbe5d8d01c1b09a544253f","PackageCount":1},{"ProjectRoot":"github.com/sdboyer/deptestdos","Children":null,"Constraint":{},"Version":{},"Revision":"5c607206be5decd28e6263ffffdcee067266015e","Latest":"5c607206be5decd28e6263ffffdcee067266015e","PackageCount":1}]
[{"ProjectRoot":"github.com/sdboyer/deptest","Children":null,"Revision":"ff2948a2ac8f538c4ecd55962e919d1e13e74baf","Latest":"3f4c3bea144e112a69bbe5d8d01c1b09a544253f","PackageCount":1,"Constraint":"^0.8.0","Version":"v0.8.0"},{"ProjectRoot":"github.com/sdboyer/deptestdos","Children":null,"Revision":"5c607206be5decd28e6263ffffdcee067266015e","Latest":"5c607206be5decd28e6263ffffdcee067266015e","PackageCount":1,"Constraint":"*","Version":"v2.0.0"}]

0 comments on commit 53a432e

Please sign in to comment.