2024-02-10 15:37:38 +01:00
|
|
|
package commands
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2024-02-14 17:16:41 +01:00
|
|
|
|
|
|
|
"github.com/facundoolano/blorg/site"
|
2024-02-10 15:37:38 +01:00
|
|
|
)
|
|
|
|
|
2024-02-12 19:16:56 +01:00
|
|
|
const SRC_DIR = "src"
|
|
|
|
const TARGET_DIR = "target"
|
2024-02-12 20:27:06 +01:00
|
|
|
const LAYOUTS_DIR = "layouts"
|
2024-02-12 19:16:56 +01:00
|
|
|
|
2024-02-10 15:37:38 +01:00
|
|
|
func Init() error {
|
|
|
|
// get working directory
|
|
|
|
// default to .
|
|
|
|
// if not exist, create directory
|
|
|
|
// copy over default files
|
|
|
|
fmt.Println("not implemented yet")
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func New() error {
|
|
|
|
// prompt for title
|
|
|
|
// slugify
|
|
|
|
// fail if file already exist
|
|
|
|
// create a new .org file with the slug
|
|
|
|
// add front matter and org options
|
|
|
|
fmt.Println("not implemented yet")
|
|
|
|
return nil
|
|
|
|
}
|
2024-02-15 03:54:46 +01:00
|
|
|
|
|
|
|
// Read the files in src/ render them and copy the result to target/
|
|
|
|
// TODO add root dir override support
|
|
|
|
func Build() error {
|
|
|
|
site, err := site.Load(SRC_DIR, LAYOUTS_DIR)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
return site.Build(SRC_DIR, TARGET_DIR, true, false)
|
|
|
|
}
|