-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45 from edoardottt/devel
Add ProjectPackageVersions #35
- Loading branch information
Showing
6 changed files
with
89 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
|
||
"github.com/edoardottt/depsdev/pkg/input" | ||
"github.com/edoardottt/depsdev/pkg/output" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var packagesCmd = &cobra.Command{ | ||
Use: "packages project", | ||
Short: "Get info about a project's package versions (GitHub, GitLab, or BitBucket)", | ||
Long: `Returns the package versions which attest to being created from the specified source code repository. | ||
At most 1500 package versions are returned. (GitHub, GitLab, or BitBucket)`, | ||
Args: func(cmd *cobra.Command, args []string) error { | ||
if len(args) < 1 { | ||
return fmt.Errorf("%s %w", "one", input.ErrArgumentLeast) | ||
} | ||
|
||
return nil | ||
}, | ||
Run: func(cmd *cobra.Command, args []string) { | ||
v, err := api.GetPackageVersions(args[0]) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
vJSON, err := output.IndentJSON(v) | ||
if err != nil { | ||
log.Fatalf(err.Error()) | ||
} | ||
|
||
fmt.Println(vJSON) | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
depsdev - CLI client for deps.dev API. | ||
Free access to dependencies, licenses, advisories, and other critical health and security signals for open source package versions. | ||
@author: edoardottt, https://www.edoardoottavianelli.it/ | ||
@repository: https://github.com/edoardottt/depsdev | ||
@license: https://github.com/edoardottt/depsdev/blob/main/LICENSE | ||
*/ | ||
|
||
package depsdev | ||
|
||
type PackageVersions struct { | ||
Versions []Versions `json:"versions,omitempty"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters