From 436c55389496df053e58fcc7f4d160501b940f0b Mon Sep 17 00:00:00 2001 From: Nick Dumas Date: Tue, 16 May 2023 09:49:55 -0400 Subject: [PATCH] drafting more lipgloss stuff --- cmd/obp/cmd/hugo.go | 43 +++++++++++++++++++++++++++++++++++++++++++ cmd/obp/cmd/root.go | 14 +++++++------- 2 files changed, 50 insertions(+), 7 deletions(-) create mode 100644 cmd/obp/cmd/hugo.go diff --git a/cmd/obp/cmd/hugo.go b/cmd/obp/cmd/hugo.go new file mode 100644 index 0000000..53ea0b2 --- /dev/null +++ b/cmd/obp/cmd/hugo.go @@ -0,0 +1,43 @@ +/* +Copyright © 2023 NAME HERE +*/ +package cmd + +import ( + // "fmt" + + "github.com/spf13/cobra" +) + +var ( + source, target string +) + +// rootCmd represents the base command when called without any subcommands +var hugoCmd = &cobra.Command{ + Use: "hugo", + Short: "convert a set of Obsidian notes into a Hugo compatible directory structure", + Long: `long description`, + PreRunE: func(cmd *cobra.Command, args []string) error { + // here is where I validate arguments, open and parse config files, etc + return nil + }, +} + +func init() { + + // Here you will define your flags and configuration settings. + // Cobra supports persistent flags, which, if defined here, + // will be global for your application. + + hugoCmd.PersistentFlags().StringVar(&source, "source", "", "directory containing ready-to-publish posts") + hugoCmd.PersistentFlags().StringVar(&target, "target", "", "target Hugo directory (typically content/posts)") + + // Cobra also supports local flags, which will only run + // when this action is called directly. + // rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") + + // rootCmd.SetHelpFunc(gloss.CharmHelp) + // rootCmd.SetUsageFunc(gloss.CharmUsage) + rootCmd.AddCommand(hugoCmd) +} diff --git a/cmd/obp/cmd/root.go b/cmd/obp/cmd/root.go index 8099688..549ab1e 100644 --- a/cmd/obp/cmd/root.go +++ b/cmd/obp/cmd/root.go @@ -9,8 +9,7 @@ import ( "github.com/spf13/cobra" "github.com/spf13/viper" - - "code.ndumas.com/ndumas/obsidian-pipeline/gloss" + // "code.ndumas.com/ndumas/obsidian-pipeline/gloss" ) var cfgFile string @@ -20,9 +19,10 @@ var rootCmd = &cobra.Command{ Use: "obp", Short: "obp is a toolkit for managing your vault in headless contexts", Long: `a suite of tools for managing your obsidian vault`, - // Uncomment the following line if your bare application - // has an action associated with it: - // Run: func(cmd *cobra.Command, args []string) { }, + PreRunE: func(cmd *cobra.Command, args []string) error { + // here is where I validate arguments, open and parse config files, etc + return nil + }, } // Execute adds all child commands to the root command and sets flags appropriately. @@ -47,8 +47,8 @@ func init() { // when this action is called directly. // rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") - rootCmd.SetHelpFunc(gloss.CharmHelp) - rootCmd.SetUsageFunc(gloss.CharmUsage) + // rootCmd.SetHelpFunc(gloss.CharmHelp) + // rootCmd.SetUsageFunc(gloss.CharmUsage) } // initConfig reads in config file and ENV variables if set.