dilawar

package module
v0.0.0-...-dcc704c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 5, 2017 License: MIT Imports: 8 Imported by: 0

README

dilawar

tiny (cli based) finance manager

Install

# install with go get and make sure you have $GOPATH/bin in your path 
λ go get github.com/umayr/dilawar/cmd/dilawar

# make with source
λ git clone https://github.com/umayr/dilawar
λ cd dilawar
λ make build

# create cross platform binaries
λ git clone https://github.com/umayr/dilawar
λ cd dilawar
λ make cross

or you can download the pre-compiled version of binaries from here.

Usage

Global Help:

λ dilawar --help
NAME:
   dilawar - tiny finance manager

USAGE:
   dilawar [global options] command [command options] [arguments...]

VERSION:
   0.1.0

COMMANDS:
     debit    adds amount in debit
     credit   adds amount in credit
     history  shows all history
     help, h  Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --help, -h     show help
   --version, -v  print the version

credit subcommand help:

λ dilawar credit -h
NAME:
   dilawar credit - adds amount in credit

USAGE:
   dilawar credit [command options] [arguments...]

OPTIONS:
   --amount value, -a value   amount to be added (default: 0)
   --message value, -m value  message for the transaction

debit subcommand help:

λ dilawar debit -h
NAME:
   dilawar debit - adds amount in debit

USAGE:
   dilawar debit [command options] [arguments...]

OPTIONS:
   --amount value, -a value   amount to be added (default: 0)
   --message value, -m value  message for the transaction

history subcommand help:

λ dilawar history -h
NAME:
   dilawar history - shows all history

USAGE:
   dilawar history [command options] [arguments...]

OPTIONS:
   --csv  outputs as comma seperate values

no output if there's not record:

λ dilawar

add a credit:

λ dilawar credit -a 1000 -m "chips"

check balance:

λ dilawar
-1000

more transactions:

# pay half debt
λ dilawar debit -a 500 -m "half"
# check balance again
λ dilawar
-500
# pay more than what you owe
λ dilawar debit -a 1000 -m "new month"
# check balance again
λ dilawar
500

show history:

λ dilawar history
  ID | DESCRIPTION |      TIME      | TYPE  |  AMOUNT    
+----+-------------+----------------+-------+-----------+
   1 | chips       | 49 seconds ago | CR    | 1,000 PKR  
   2 | half        | 30 seconds ago | DR    | 500 PKR    
   3 | new month   | 9 seconds ago  | DR    | 1,000 PKR  
+----+-------------+----------------+-------+-----------+
                                      TOTAL |    500     
                                    +-------+-----------+

save history as CSV:

λ dilawar history -csv > records.csv

remove all data:

λ rm -rf ~/.dilawar

Lisence

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Balance

func Balance() (int, error)

func Credit

func Credit(amount int, msg string) error

func Debit

func Debit(amount int, msg string) error

Types

type Storable

type Storable interface {
	Create(*Transaction) error
	Read(int) *Transaction
	List() []Transaction
}

type Store

type Store struct{}

func NewStore

func NewStore() *Store

func (*Store) Create

func (s *Store) Create(t *Transaction) error

func (*Store) List

func (s *Store) List() ([]Transaction, error)

func (*Store) Read

func (s *Store) Read(id int) (*Transaction, error)

type Transaction

type Transaction struct {
	ID          uint64
	Amount      int
	Type        Type
	Description string
	Time        time.Time
}

func History

func History() ([]Transaction, error)

func (Transaction) String

func (t Transaction) String() string

type Type

type Type string
const (
	TypeCredit Type = "credit"
	TypeDebit  Type = "debit"
)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL