Do a large chunk of the move to go
This commit moves a huge chunk of the code to go. The TODO.md document indicates what is left to be done.
This commit is contained in:
parent
db2ad9b4bd
commit
7b38fdd801
93 changed files with 4689 additions and 645 deletions
38
cmd/ls.go
Normal file
38
cmd/ls.go
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
package cmd
|
||||
|
||||
import (
|
||||
wisski_distillery "github.com/FAU-CDI/wisski-distillery"
|
||||
"github.com/FAU-CDI/wisski-distillery/env"
|
||||
)
|
||||
|
||||
// Ls is the 'ls' command
|
||||
var Ls wisski_distillery.Command = ls{}
|
||||
|
||||
type ls struct {
|
||||
Positionals struct {
|
||||
Slug []string `positional-arg-name:"SLUG" required:"0" description:"slug(s) of instance(s) to list"`
|
||||
} `positional-args:"true"`
|
||||
}
|
||||
|
||||
func (ls) Description() wisski_distillery.Description {
|
||||
return wisski_distillery.Description{
|
||||
Requirements: env.Requirements{
|
||||
NeedsConfig: true,
|
||||
},
|
||||
Command: "ls",
|
||||
Description: "Lists WissKI instances",
|
||||
}
|
||||
}
|
||||
|
||||
func (l ls) Run(context wisski_distillery.Context) error {
|
||||
instances, err := context.Environment.Instances(l.Positionals.Slug...)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, instance := range instances {
|
||||
context.Println(instance.Slug)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue