summaryrefslogtreecommitdiff
path: root/cmd/build.go
blob: 298a17bca4ba7680e42eac9ae6678f692ca0441e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package cmd

import (
	"fmt"
	"log"
	"os"

	"github.com/HimanshuSardana/kite/internal/build"
	"github.com/HimanshuSardana/kite/pkg/config"
)

func runBuild(args []string) {
	themeName := DefaultTheme

	if cfg, err := config.Load("config.yaml"); err == nil && cfg.DefaultTheme != "" {
		themeName = cfg.DefaultTheme
	}

	if len(args) > 2 {
		themeName = args[2]
	}

	opts := build.BuildOptions{
		ThemeName: themeName,
	}

	fmt.Printf("Building with theme: %s\n", themeName)

	if err := build.Build(opts); err != nil {
		log.Fatalf("Build failed: %v", err)
		os.Exit(1)
	}

	fmt.Println("Build completed successfully!")
}