cmd/stepd: List all loaded providers on startup
This commit is contained in:
parent
ab167234d0
commit
9a6607494f
@ -8,6 +8,7 @@ import "slices"
|
|||||||
import "errors"
|
import "errors"
|
||||||
import "context"
|
import "context"
|
||||||
import "net/http"
|
import "net/http"
|
||||||
|
import "unicode/utf8"
|
||||||
import "path/filepath"
|
import "path/filepath"
|
||||||
import "git.tebibyte.media/sashakoshka/step"
|
import "git.tebibyte.media/sashakoshka/step"
|
||||||
import "git.tebibyte.media/sashakoshka/go-cli"
|
import "git.tebibyte.media/sashakoshka/go-cli"
|
||||||
@ -114,6 +115,9 @@ func main () {
|
|||||||
err := environment.Init(context.Background())
|
err := environment.Init(context.Background())
|
||||||
if err != nil { log.Fatal(err) }
|
if err != nil { log.Fatal(err) }
|
||||||
|
|
||||||
|
// TODO: load plugins
|
||||||
|
logProviders(environment.Providers)
|
||||||
|
|
||||||
// set up the HTTP handler
|
// set up the HTTP handler
|
||||||
handler := stephttp.Handler {
|
handler := stephttp.Handler {
|
||||||
Environment: &environment,
|
Environment: &environment,
|
||||||
@ -172,3 +176,27 @@ func (this *httpServerRoutine) Run (ctx context.Context) error {
|
|||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func logProviders (providers []step.Provider) {
|
||||||
|
output := "providers: "
|
||||||
|
x := utf8.RuneCountInString(output)
|
||||||
|
for index, provider := range providers {
|
||||||
|
packag := provider.Package()
|
||||||
|
if index != len(providers) - 1 {
|
||||||
|
packag += ", "
|
||||||
|
x += 2
|
||||||
|
}
|
||||||
|
packageLen := utf8.RuneCountInString(packag)
|
||||||
|
if x + packageLen >= 60 && output != "" {
|
||||||
|
log.Println("(i)", output)
|
||||||
|
output = ""
|
||||||
|
x = 2
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
output += packag
|
||||||
|
x += packageLen
|
||||||
|
}
|
||||||
|
if output != "" {
|
||||||
|
log.Println("(i)", output)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user