From e729953cab3babdb948d5ed8ad527b710f65060c Mon Sep 17 00:00:00 2001 From: Randall Winkhart Date: Thu, 7 Mar 2024 17:40:57 -0500 Subject: [PATCH] Implement entry/directory renaming/moving --- src/cli/edit.go | 15 +++++++++++++++ src/cli/printInfo.go | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 src/cli/edit.go diff --git a/src/cli/edit.go b/src/cli/edit.go new file mode 100644 index 0000000..7787d42 --- /dev/null +++ b/src/cli/edit.go @@ -0,0 +1,15 @@ +package cli + +import "github.com/rwinkhart/MUTN/src/offline" + +// RenameCli renames an entry at oldLocation to a new location (user input) +func RenameCli(oldLocation string) { + // ensure targetLocation exists + offline.TargetIsFile(oldLocation, true, 0) + + // prompt user for new location and rename + newLocation := offline.EntryRoot + offline.PathSeparator + input("New location:") + offline.Rename(oldLocation, newLocation) + + // exit is done from offline.Rename +} diff --git a/src/cli/printInfo.go b/src/cli/printInfo.go index b8ddc1a..62924de 100644 --- a/src/cli/printInfo.go +++ b/src/cli/printInfo.go @@ -37,7 +37,7 @@ This program comes with absolutely no warranty; type "mutn version" for details. note/-n Add a note entry folder/-f Add a new folder for entries edit: - rename/relocate/-r Rename or relocate an entry + rename/-r Rename or relocate an entry username/-u Change the username of an entry password/-p Change the password of an entry url/-l Change the url attached to an entry