summaryrefslogtreecommitdiff
path: root/cmd/main.go
diff options
context:
space:
mode:
authorHimanshu Sardana <himanshusardana2005@gmail.com>2026-03-26 21:26:35 +0000
committerHimanshu Sardana <himanshusardana2005@gmail.com>2026-03-26 21:26:35 +0000
commit103e84d847262830bbaa550b37218e9ca8b317d3 (patch)
treee19d3bfd6594600fb28be1ccac1a3869207bc49c /cmd/main.go
parent5c631f0cdb8ee3238ff054d171dd8babd158047b (diff)
refactor: split into cmd, pkg
Diffstat (limited to 'cmd/main.go')
-rw-r--r--cmd/main.go71
1 files changed, 0 insertions, 71 deletions
diff --git a/cmd/main.go b/cmd/main.go
deleted file mode 100644
index 13970cc..0000000
--- a/cmd/main.go
+++ /dev/null
@@ -1,71 +0,0 @@
-package main
-
-import (
- "fmt"
- "io"
- "log"
- "net/http"
- "os"
- "path/filepath"
- "strings"
-
- internal "github.com/HimanshuSardana/kite/internal/build"
-)
-
-func copyFile(src, dst string) error {
- in, err := os.Open(src)
- if err != nil {
- return err
- }
- defer in.Close()
-
- if err := os.MkdirAll(filepath.Dir(dst), os.ModePerm); err != nil {
- return err
- }
-
- out, err := os.Create(dst)
- if err != nil {
- return err
- }
- defer out.Close()
-
- _, err = io.Copy(out, in)
- return err
-}
-
-var defaultThemeName = "modern-dark"
-
-func main() {
- args := os.Args
- if len(args) > 1 {
- switch args[1] {
- case "serve":
- copyFile("./themes/"+defaultThemeName+"/style.css", "./output/style.css")
-
- fs := http.FileServer(http.Dir("./output/"))
- http.Handle("/", fs)
-
- log.Println("Serving on http://localhost:8000")
-
- err := http.ListenAndServe(":8000", nil)
- if err != nil {
- log.Fatalf("Error occured %s\n", err)
- }
- case "build":
- if len(os.Args) <= 2 {
- themeName := defaultThemeName
- internal.Build(themeName)
- } else {
- themeName := os.Args[2]
- internal.Build(themeName)
- }
- case "list-themes":
- themeList := internal.ListThemes()
- fmt.Println(strings.Join(themeList, "\n"))
- default:
- internal.ShowHelpMessage()
- }
- } else {
- internal.ShowHelpMessage()
- }
-}