init commit

This commit is contained in:
Yehoshua Adam Sandler
2026-02-05 15:33:07 -06:00
commit e70b629b4a
13 changed files with 1021 additions and 0 deletions

29
config/config.go Normal file
View File

@@ -0,0 +1,29 @@
package config
import (
"os"
"path/filepath"
"github.com/spf13/viper"
)
func Init() {
viper.SetConfigName("config")
viper.SetConfigType("json")
configDir := filepath.Join(userConfigDir(), "mach")
viper.AddConfigPath(configDir)
viper.SetDefault("input_type", "md")
viper.SetDefault("output_type", "rtf")
_ = viper.ReadInConfig() // config file is optional
}
func userConfigDir() string {
if dir, err := os.UserConfigDir(); err == nil {
return dir
}
home, _ := os.UserHomeDir()
return filepath.Join(home, ".config")
}