~bouncepaw/mycorrhiza

7140c79b63ec4e561843375804063eb8edcf3de7 — Timur Ismagilov 1 year, 2 days ago bdb5bfc
Rename: Leave transclusion on redirection hyphae
1 files changed, 5 insertions(+), 1 deletions(-)

M shroom/rename.go
M shroom/rename.go => shroom/rename.go +5 -1
@@ 93,9 93,13 @@ func Rename(oldHypha hyphae.ExistingHypha, newName string, recursive bool, leave
	return nil
}

const redirectionTemplate = `=> %[1]s | ✏️ %[2]s
<= %[1]s | full
`

func leaveRedirection(oldName, newName string, hop *history.Op) error {
	var (
		text       = fmt.Sprintf("=> %s | ✏️ %s\n", newName, util.BeautifulName(newName))
		text       = fmt.Sprintf(redirectionTemplate, newName, util.BeautifulName(newName))
		emptyHypha = hyphae.ByName(oldName)
	)
	switch emptyHypha := emptyHypha.(type) {