ugh
parent
069e769972
commit
2c9b84bb6c
@ -0,0 +1,49 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
|
||||
"go.uber.org/zap"
|
||||
|
||||
"code.ndumas.com/ndumas/obsidian-pipeline"
|
||||
)
|
||||
|
||||
func main() {
|
||||
am := NewAttachmentMover()
|
||||
defer am.L.Sync()
|
||||
|
||||
flag.StringVar(&am.Source, "source", "", "source directory containing your vault")
|
||||
flag.StringVar(&am.Target, "target", "", "target directory containing your hugo site")
|
||||
flag.StringVar(&am.AttachmentsDir, "attachments", "", "directory containing your vault's attachments")
|
||||
flag.StringVar(&am.BlogDir, "blog", "", "vault directory containing blog posts to-be-published")
|
||||
|
||||
flag.Parse()
|
||||
|
||||
switch {
|
||||
case am.Source == "":
|
||||
am.L.Fatal("please provide -source")
|
||||
fallthrough
|
||||
case am.Target == "":
|
||||
am.L.Fatal("please provide -target")
|
||||
fallthrough
|
||||
case am.AttachmentsDir == "":
|
||||
am.L.Fatal("please provide -attachments")
|
||||
fallthrough
|
||||
case am.BlogDir == "":
|
||||
am.L.Fatal("please provide -blog")
|
||||
}
|
||||
|
||||
if am.Source == "" || am.Target == "" {
|
||||
am.L.Fatal("flags not provided")
|
||||
}
|
||||
|
||||
err := am.Walk()
|
||||
if err != nil {
|
||||
am.L.Fatal("error walking blog or notes dir to gather file names", zap.Error(err))
|
||||
}
|
||||
|
||||
err = am.Move()
|
||||
if err != nil {
|
||||
am.L.Fatal("error moving notes", zap.Error(err))
|
||||
}
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
func main() {
|
||||
am := NewAttachmentMover()
|
||||
defer am.L.Sync()
|
||||
|
||||
flag.StringVar(&am.Source, "source", "", "source directory containing your vault")
|
||||
flag.StringVar(&am.Target, "target", "", "target directory containing your hugo site")
|
||||
flag.StringVar(&am.AttachmentsDir, "attachments", "", "directory containing your vault's attachments")
|
||||
flag.StringVar(&am.BlogDir, "blog", "", "vault directory containing blog posts to-be-published")
|
||||
|
||||
flag.Parse()
|
||||
|
||||
switch {
|
||||
case am.Source == "":
|
||||
am.L.Fatal("please provide -source")
|
||||
fallthrough
|
||||
case am.Target == "":
|
||||
am.L.Fatal("please provide -target")
|
||||
fallthrough
|
||||
case am.AttachmentsDir == "":
|
||||
am.L.Fatal("please provide -attachments")
|
||||
fallthrough
|
||||
case am.BlogDir == "":
|
||||
am.L.Fatal("please provide -blog")
|
||||
}
|
||||
|
||||
if am.Source == "" || am.Target == "" {
|
||||
am.L.Fatal("flags not provided")
|
||||
}
|
||||
|
||||
err := am.Walk()
|
||||
if err != nil {
|
||||
am.L.Fatal("error walking blog or notes dir to gather file names", zap.Error(err))
|
||||
}
|
||||
|
||||
err = am.Move()
|
||||
if err != nil {
|
||||
am.L.Fatal("error moving notes", zap.Error(err))
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue