aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorClemens Fries <github-clockrotz@xenoworld.de>2016-12-12 19:10:37 +0100
committerClemens Fries <github-clockrotz@xenoworld.de>2016-12-12 19:10:37 +0100
commit3f192bf2e304134b473135c66ff2c039f7a99c3d (patch)
tree995668a251b8a68174113b8ef4de918110346943 /cmd
parent533681e0f83ec4f69b3b8e9f1982ed9f089285b4 (diff)
create: enable saving message under a different name
Diffstat (limited to 'cmd')
-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)