list

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 29, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Command = &cli.Command{
	Name:  "list",
	Usage: "List all releases of the specified software",
	Flags: []cli.Flag{
		&cli.StringFlag{
			Name:  "range",
			Usage: "semver `RANGE` to query from. See https://godoc.org/github.com/blang/semver/v4#ParseRange for the accepted syntax.",
		},
		&cli.BoolFlag{
			Name:  "semver",
			Usage: "display parsed semver instead of the original version name.",
		},
	},
	Action: func(c *cli.Context) error {
		var vrange semver.Range
		vrangestr := c.String("range")
		if vrangestr != "" {
			var err error
			vrange, err = semver.ParseRange(vrangestr)
			if err != nil {
				return err
			}
		}

		softwareId := strings.TrimSpace(c.Args().First())
		rs, err := fetch.Direct{}.Fetch(c.Context, softwareId)
		if err != nil {
			return err
		}
		rs = rs.SelectAll(vrange)

		if c.Bool("semver") {
			for _, r := range rs {
				fmt.Printf("%s\n", r.Version)
			}

			return nil
		}
		for _, r := range rs {
			fmt.Printf("%s\n", r.OriginalName)
		}

		return nil
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL