Add initial triplestore rebuild functionality
This commit is contained in:
parent
8a1319df16
commit
674b9d8d07
11 changed files with 252 additions and 56 deletions
35
cmd/rebuild_ts.go
Normal file
35
cmd/rebuild_ts.go
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
package cmd
|
||||
|
||||
import (
|
||||
wisski_distillery "github.com/FAU-CDI/wisski-distillery"
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/cli"
|
||||
)
|
||||
|
||||
// RebuildTS is the 'rebuild_ts' setting
|
||||
var RebuildTS wisski_distillery.Command = rebuildTS{}
|
||||
|
||||
type rebuildTS struct {
|
||||
AllowEmptyRepository bool `short:"a" long:"allow-empty" description:"don't abort if repository is empty"`
|
||||
Positionals struct {
|
||||
Slug string `positional-arg-name:"SLUG" required:"1-1" description:"slug of instance to rebuild triplestore for"`
|
||||
} `positional-args:"true"`
|
||||
}
|
||||
|
||||
func (rebuildTS) Description() wisski_distillery.Description {
|
||||
return wisski_distillery.Description{
|
||||
Requirements: cli.Requirements{
|
||||
NeedsDistillery: true,
|
||||
},
|
||||
Command: "rebuild_ts",
|
||||
Description: "rebuild the triplestore for a specific instance",
|
||||
}
|
||||
}
|
||||
|
||||
func (rts rebuildTS) Run(context wisski_distillery.Context) (err error) {
|
||||
instance, err := context.Environment.Instances().WissKI(context.Context, rts.Positionals.Slug)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return instance.TRB().DoSomething(context.Context, context.Stdout, rts.AllowEmptyRepository)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue