Files
sablier/pkg/sabliercmd/theme.go
Alexis Couvreur 0f4a3a2e93 refactor: add sabliercmd pkg (#727)
This will enable doc generation
2025-11-13 20:18:57 -05:00

30 lines
835 B
Go

package sabliercmd
import (
"context"
"log/slog"
"os"
"github.com/sablierapp/sablier/pkg/config"
"github.com/sablierapp/sablier/pkg/theme"
)
func setupTheme(ctx context.Context, conf config.Config, logger *slog.Logger) (*theme.Themes, error) {
if conf.Strategy.Dynamic.CustomThemesPath != "" {
logger.DebugContext(ctx, "loading themes from custom theme path", slog.String("path", conf.Strategy.Dynamic.CustomThemesPath))
custom := os.DirFS(conf.Strategy.Dynamic.CustomThemesPath)
t, err := theme.NewWithCustomThemes(custom, logger)
if err != nil {
return nil, err
}
return t, nil
}
logger.DebugContext(ctx, "loading themes without custom theme path", slog.String("reason", "--strategy.dynamic.custom-themes-path is empty"))
t, err := theme.New(logger)
if err != nil {
return nil, err
}
return t, nil
}