fix post filename already exist handling

This commit is contained in:
facundoolano 2024-02-27 12:25:03 -03:00
parent 6f27afacf7
commit 37f1675edc

View file

@ -58,9 +58,9 @@ func (cmd *Post) Run(ctx *kong.Context) error {
// if file already exists, prompt user for a different one // if file already exists, prompt user for a different one
if _, err := os.Stat(path); err == nil { if _, err := os.Stat(path); err == nil {
fmt.Printf("%s already exists\n", path) fmt.Printf("%s already exists, choose another path\n", path)
filename = Prompt("filename") filename = Prompt("filename")
path = filepath.Join(config.SrcDir, filename) path = filepath.Join(filename)
} }
// initialize the post front matter // initialize the post front matter