aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/create.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/create.go')
-rw-r--r--cmd/create.go15
1 files changed, 14 insertions, 1 deletions
diff --git a/cmd/create.go b/cmd/create.go
index 3d02bc7..cba38b5 100644
--- a/cmd/create.go
+++ b/cmd/create.go
@@ -113,7 +113,7 @@ func Create(argv []string, conf *Configuration) {
cmd.Run()
if cmd.ProcessState.Success() {
- fmt.Printf("\nSave message? ([(y)es], (d)raft, (n)o): ")
+ fmt.Printf("\nSave message? ([(y)es], (r)enamed, (d)raft, (n)o): ")
reader := bufio.NewReader(os.Stdin)
response, err := reader.ReadString('\n')
@@ -133,6 +133,19 @@ func Create(argv []string, conf *Configuration) {
dst = filepath.Join(todoDir, filepath.Base(tmpFile.Name())+".msg")
dst, err = copyFile(tmpFile.Name(), dst, false)
saved = true
+ case "r", "renamed":
+ fmt.Printf("\nSpecify new name: ")
+ reader := bufio.NewReader(os.Stdin)
+ response, err := reader.ReadString('\n')
+
+ if err != nil {
+ fmt.Printf("Error when reading response: %s\n", err.Error())
+ os.Exit(1)
+ }
+
+ dst = filepath.Join(todoDir, strings.TrimSpace(response)+".msg")
+ dst, err = copyFile(tmpFile.Name(), dst, false)
+ saved = true
case "d", "draft":
dst = filepath.Join(draftsDir, filepath.Base(tmpFile.Name())+".msg")
dst, err = copyFile(tmpFile.Name(), dst, false)