Signed-off-by: Oliver Davies <oliver@oliverdavies.uk>
This commit is contained in:
Oliver Davies 2025-10-01 12:00:00 +01:00
parent 53a64be850
commit 665ef94ca9
2 changed files with 5 additions and 5 deletions

View file

@ -7,7 +7,7 @@ import (
"code.oliverdavies.uk/opdavies/cmd-zet/internal/lib"
)
func EditFile(filePath string) {
func Edit(filePath string) {
if _, err := os.Stat(filePath); os.IsNotExist(err) {
fmt.Printf("Error: The file for path '%s' was not found\n", filePath)
os.Exit(1)
@ -22,7 +22,7 @@ func EditFile(filePath string) {
}
}
func ViewFile(filePath string) string {
func View(filePath string) string {
if _, err := os.Stat(filePath); os.IsNotExist(err) {
fmt.Printf("Error: The file for path '%s' was not found\n", filePath)
os.Exit(1)

View file

@ -40,7 +40,7 @@ func CreateZet(title string) {
log.Fatal(err)
}
file.EditFile(filePath)
file.Edit(filePath)
onSave(zid)
}
@ -48,7 +48,7 @@ func CreateZet(title string) {
func EditZet(id int) {
zetPath := path.Join(config.GetZetDir(), strconv.Itoa(id), "index.adoc")
file.EditFile(zetPath)
file.Edit(zetPath)
onSave(id)
}
@ -141,7 +141,7 @@ func ParseZetList(ids []int) []string {
func ViewZet(id int) string {
zetPath := path.Join(config.GetZetDir(), strconv.Itoa(id), "index.adoc")
return file.ViewFile(zetPath)
return file.View(zetPath)
}
func getTitle(id int) string {