Fixes bug where path did not get updated after save-as. Also adds extensions as needed to given save paths.
This commit is contained in:
parent
5eb59cf6c6
commit
cd7108da7d
11
main.go
11
main.go
|
@ -39,7 +39,12 @@ func runCommand(elems []string) {
|
|||
case "write", "w":
|
||||
if len(elems) >= 2 {
|
||||
path := ExpandedAbsFilepath(strings.Join(elems[1:], " "))
|
||||
if filepath.Ext(path) == "" {
|
||||
path = path + ".tss"
|
||||
}
|
||||
WriteFile(path)
|
||||
wb.path = path
|
||||
wb.name = filepath.Base(path)
|
||||
} else {
|
||||
path := wb.path
|
||||
ext := filepath.Ext(path)
|
||||
|
@ -52,6 +57,9 @@ func runCommand(elems []string) {
|
|||
case "write-csv", "wc":
|
||||
if len(elems) >= 2 {
|
||||
path := ExpandedAbsFilepath(strings.Join(elems[1:], " "))
|
||||
if filepath.Ext(path) == "" {
|
||||
path = path + ".csv"
|
||||
}
|
||||
WriteCsv(path, false)
|
||||
} else {
|
||||
path := wb.path
|
||||
|
@ -64,6 +72,9 @@ func runCommand(elems []string) {
|
|||
case "write-tsv", "wt":
|
||||
if len(elems) >= 2 {
|
||||
path := ExpandedAbsFilepath(strings.Join(elems[1:], " "))
|
||||
if filepath.Ext(path) == "" {
|
||||
path = path + ".tsv"
|
||||
}
|
||||
WriteCsv(path, true)
|
||||
} else {
|
||||
path := wb.path
|
||||
|
|
Loading…
Reference in New Issue