drafting the hugo subcommand

main
Nick Dumas 2 years ago
parent cff10a36ca
commit 7271830829

@ -4,11 +4,15 @@ Copyright © 2023 NAME HERE <EMAIL ADDRESS>
package cmd
import (
"log"
// "fmt"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
var source, target string
var hugoCmd = &cobra.Command{
Use: "hugo",
Short: "convert a set of Obsidian notes into a Hugo compatible directory structure",
@ -23,8 +27,19 @@ var hugoCmd = &cobra.Command{
}
func init() {
// hugoCmd.Flags().StringVar(&source, "source", "", "directory containing ready-to-publish posts")
// hugoCmd.Flags().StringVar(&target, "target", "", "target Hugo directory (typically content/posts)")
hugoCmd.Flags().StringP("source", "s", "", "path to vault directory containing hugo posts")
hugoCmd.Flags().StringP("target", "t", "", "hugo content/ directory")
hugoCmd.MarkFlagsRequiredTogether("source", "target")
err := viper.BindPFlag("source", hugoCmd.Flags().Lookup("schema"))
if err != nil {
log.Panicln("error binding viper to source flag:", err)
}
err = viper.BindPFlag("target", hugoCmd.Flags().Lookup("target"))
if err != nil {
log.Panicln("error binding viper to target flag:", err)
}
rootCmd.AddCommand(hugoCmd)
}

@ -75,7 +75,6 @@ func init() {
validateCmd.Flags().StringP("target", "t", "", "directory containing validation targets")
validateCmd.MarkFlagsRequiredTogether("schema", "target")
validateCmd.PersistentFlags().StringVar(&format, "format", "markdown", "output format [markdown, json, csv]")
rootCmd.AddCommand(validateCmd)
err := viper.BindPFlag("schema", validateCmd.Flags().Lookup("schema"))
if err != nil {
@ -91,4 +90,6 @@ func init() {
if err != nil {
log.Panicln("error binding viper to format flag:", err)
}
rootCmd.AddCommand(validateCmd)
}

@ -0,0 +1,13 @@
package obp
func Copy(src, dst string) error {
return nil
}
func Sanitize(src string) error {
return nil
}
func GatherMedia(src string) error {
return nil
}
Loading…
Cancel
Save