Skip to content

Commit

Permalink
Add resume editing for failed import
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Persson committed Feb 16, 2016
1 parent 69065e3 commit 99e89d9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions src/github.com/mickep76/etcdtool/command/edit_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,16 @@ func editCommandFunc(c *cli.Context) {
// Temporary file append file type to support syntax highlighting
tmpfile := c.String("tmp-file") + "." + strings.ToLower(c.String("format"))

// Export to file.
exportFunc(dir, sort, tmpfile, f, c, ki)
// If file exist's resume editing?
if _, err := os.Stat(tmpfile); os.IsNotExist(err) {
// Export to file.
exportFunc(dir, sort, tmpfile, f, c, ki)
} else {
if !askYesNo(fmt.Sprintf("Temp. file already exist's resume editing")) {
// Export to file.
exportFunc(dir, sort, tmpfile, f, c, ki)
}
}

// Get modified time stamp.
before, err := os.Stat(tmpfile)
Expand Down
2 changes: 1 addition & 1 deletion src/github.com/mickep76/etcdtool/version.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package main

// Version for app.
const Version = "3.0"
const Version = "3.1"

0 comments on commit 99e89d9

Please sign in to comment.