mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-27 14:10:31 +03:00
parent
f363faadab
commit
be28d9d943
2 changed files with 15 additions and 7 deletions
|
@ -59,17 +59,17 @@ func Undraft(cmd *cobra.Command, args []string) error {
|
|||
|
||||
w, err := undraftContent(p)
|
||||
if err != nil {
|
||||
return newSystemError("an error occurred while undrafting %q: %s", location, err)
|
||||
return newSystemErrorF("an error occurred while undrafting %q: %s", location, err)
|
||||
}
|
||||
|
||||
f, err = os.OpenFile(location, os.O_WRONLY|os.O_TRUNC, 0644)
|
||||
if err != nil {
|
||||
return newSystemError("%q not be undrafted due to error opening file to save changes: %q\n", location, err)
|
||||
return newSystemErrorF("%q not be undrafted due to error opening file to save changes: %q\n", location, err)
|
||||
}
|
||||
defer f.Close()
|
||||
_, err = w.WriteTo(f)
|
||||
if err != nil {
|
||||
return newSystemError("%q not be undrafted due to save error: %q\n", location, err)
|
||||
return newSystemErrorF("%q not be undrafted due to save error: %q\n", location, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue