Browse Source

updated location of pending file

bmallred 10 years ago
parent
commit
935c8ca2f3
5 changed files with 9 additions and 11 deletions
  1. 2 2
      commandClear.go
  2. 2 2
      commandCommit.go
  3. 2 2
      commandCredit.go
  4. 2 2
      commandDebit.go
  5. 1 3
      commandStatus.go

+ 2 - 2
commandClear.go

@ -1,8 +1,8 @@
1 1
package main
2 2
3 3
import (
4
	"fmt"
4 5
	"os"
5
	"path/filepath"
6 6
7 7
	"github.com/codegangsta/cli"
8 8
)
@ -24,7 +24,7 @@ var commandClear = cli.Command{
24 24
25 25
// Clear current pending transaction
26 26
func actionClear(c *cli.Context) {
27
	pendingFile := filepath.Join(os.TempDir(), c.String("file"))
27
	pendingFile := fmt.Sprintf(".%s", c.String("file"))
28 28
	ensureFileExists(pendingFile)
29 29
30 30
	file, err := os.OpenFile(pendingFile, os.O_TRUNC|os.O_WRONLY, 0666)

+ 2 - 2
commandCommit.go

@ -2,9 +2,9 @@ package main
2 2
3 3
import (
4 4
	"errors"
5
	"fmt"
5 6
	"io/ioutil"
6 7
	"os"
7
	"path/filepath"
8 8
	"strings"
9 9
	"time"
10 10
@ -36,7 +36,7 @@ func actionCommit(c *cli.Context) {
36 36
	ledgerFile := c.String("file")
37 37
	ensureFileExists(ledgerFile)
38 38
39
	pendingFile := filepath.Join(os.TempDir(), c.String("file"))
39
	pendingFile := fmt.Sprintf(".%s", c.String("file"))
40 40
	ensureFileExists(pendingFile)
41 41
42 42
	date, err := parseDate(c.String("date"))

+ 2 - 2
commandCredit.go

@ -1,8 +1,8 @@
1 1
package main
2 2
3 3
import (
4
	"fmt"
4 5
	"os"
5
	"path/filepath"
6 6
7 7
	"github.com/codegangsta/cli"
8 8
)
@ -24,7 +24,7 @@ var commandCredit = cli.Command{
24 24
25 25
// Add a credit to the pending transaction
26 26
func actionCredit(c *cli.Context) {
27
	pendingFile := filepath.Join(os.TempDir(), c.String("file"))
27
	pendingFile := fmt.Sprintf(".%s", c.String("file"))
28 28
	ensureFileExists(pendingFile)
29 29
30 30
	args := c.Args()

+ 2 - 2
commandDebit.go

@ -1,8 +1,8 @@
1 1
package main
2 2
3 3
import (
4
	"fmt"
4 5
	"os"
5
	"path/filepath"
6 6
7 7
	"github.com/codegangsta/cli"
8 8
)
@ -24,7 +24,7 @@ var commandDebit = cli.Command{
24 24
25 25
// Add a debit to the pending transaction
26 26
func actionDebit(c *cli.Context) {
27
	pendingFile := filepath.Join(os.TempDir(), c.String("file"))
27
	pendingFile := fmt.Sprintf(".%s", c.String("file"))
28 28
	ensureFileExists(pendingFile)
29 29
30 30
	args := c.Args()

+ 1 - 3
commandStatus.go

@ -3,8 +3,6 @@ package main
3 3
import (
4 4
	"fmt"
5 5
	"io/ioutil"
6
	"os"
7
	"path/filepath"
8 6
9 7
	"github.com/codegangsta/cli"
10 8
)
@ -26,7 +24,7 @@ var commandStatus = cli.Command{
26 24
27 25
// Display the current status of the ledger
28 26
func actionStatus(c *cli.Context) {
29
	pendingFile := filepath.Join(os.TempDir(), c.String("file"))
27
	pendingFile := fmt.Sprintf(".%s", c.String("file"))
30 28
	ensureFileExists(pendingFile)
31 29
32 30
	if hasPendingTransaction(pendingFile) {