feat: implement list of available distros
This commit is contained in:
14
distro.go
14
distro.go
@ -6,6 +6,7 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/cavaliergopher/grab/v3"
|
||||
@ -21,7 +22,9 @@ import (
|
||||
)
|
||||
|
||||
type DistroCmd struct {
|
||||
Debian DebianCmd `cmd:""`
|
||||
List DistroListCmd `cmd:"" help:"list available distros"`
|
||||
|
||||
Debian DebianCmd `cmd:"" hidden:""`
|
||||
}
|
||||
|
||||
type DebianCmd struct {
|
||||
@ -183,3 +186,12 @@ func (cmd *DebianFetchCmd) Run(dcmd *DebianCmd) (err error) {
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
type DistroListCmd struct{}
|
||||
|
||||
func (cmd *DistroListCmd) Run() (err error) {
|
||||
for _, d := range distro.List() {
|
||||
fmt.Println(d.ID, strings.Title(d.Release))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
Reference in New Issue
Block a user