summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.go6
-rw-r--r--[-rwxr-xr-x]makefile0
-rw-r--r--texify.go13
3 files changed, 11 insertions, 8 deletions
diff --git a/config.go b/config.go
index 1db87a9..734983d 100644
--- a/config.go
+++ b/config.go
@@ -13,6 +13,7 @@ import (
type Config struct {
Database string //`toml:"database"`
+ Folder string //`toml:"folder"`
Name string //`toml:"name"`
Street string //`toml:"street"`
Zip string //`toml:"zip"`
@@ -85,10 +86,11 @@ func makeNewTOML(gibts bool) {
n := ""
file, err := homedir.Expand("~/.mywork.db")
checkErr(err)
- config = Config{file, n, n, n, n, n, n, n, n, n, n, n, n, n, n, n}
+ config = Config{file, n, n, n, n, n, n, n, n, n, n, n, n, n, n, n, n}
}
//fmt.Println("Whats Your Namecount\n")
database := getNewInterInput("DB File Path: ", config.Database, nli)
+ folder := getNewInterInput("Template Folder: ", config.Folder, nli)
name := getNewInterInput("Whats your Name?: ", config.Name, nli)
street := getNewInterInput("Street: ", config.Street, nli)
zip := getNewInterInput("Zip Code: ", config.Zip, nli)
@@ -105,7 +107,7 @@ func makeNewTOML(gibts bool) {
iban := getNewInterInput("IBAN: ", config.Iban, nli)
bic := getNewInterInput("BIC: ", config.Bic, nli)
- conf := Config{database, name, street, zip, city, country, telefon, mobile, mail, url, taxid, bankacc, banklz, bankname, iban, bic}
+ conf := Config{database, folder, name, street, zip, city, country, telefon, mobile, mail, url, taxid, bankacc, banklz, bankname, iban, bic}
buf := new(bytes.Buffer)
err = toml.NewEncoder(buf).Encode(conf)
diff --git a/makefile b/makefile
index 5532ae8..5532ae8 100755..100644
--- a/makefile
+++ b/makefile
diff --git a/texify.go b/texify.go
index 99a7261..d802108 100644
--- a/texify.go
+++ b/texify.go
@@ -108,11 +108,12 @@ func billTemplate(billdata bill, cust Customer) Filenames {
fnames := Filenames{filenamedata, filenameinv, filenamemain}
//Parse Templates
- tmpl, err := template.New("invoice").Delims("[[", "]]").ParseGlob("templates/*.tex")
+ pars := fmt.Sprintf("%stemplates/*.tex",config.Folder)
+ tmpl, err := template.New("invoice").Delims("[[", "]]").ParseGlob(pars)
checkErr(err)
- filenamedata = fmt.Sprintf("outtex/%v_data.tex", billid)
- filenameinv = fmt.Sprintf("outtex/%v_invoice.tex", billid)
- filenamemain = fmt.Sprintf("outtex/%v_main.tex", billid)
+ filenamedata = fmt.Sprintf("%souttex/%v_data.tex", config.Folder,billid)
+ filenameinv = fmt.Sprintf("%souttex/%v_invoice.tex", config.Folder,billid)
+ filenamemain = fmt.Sprintf("%souttex/%v_main.tex",config.Folder, billid)
//Open File
datf, err := os.Create(filenamedata)
@@ -138,7 +139,7 @@ func billTemplate(billdata bill, cust Customer) Filenames {
}
func runLatex(inputfilename, outputfilename string) error {
- fmt.Printf("Rendering: %s -> Output File: outpdf/Rechnung%s.pdf\n", inputfilename, cleanString(outputfilename))
+ fmt.Printf("Rendering: %s -> Output File: %soutpdf/Rechnung%s.pdf\n", inputfilename, config.Folder,cleanString(outputfilename))
pref := strings.TrimSuffix(inputfilename, "_main.tex")
//cmdArgs := []string{"-synctex=1", "-interaction=nonstopmode", filename}
@@ -147,7 +148,7 @@ func runLatex(inputfilename, outputfilename string) error {
//env := os.Environ()
mainpdf := strings.Replace(inputfilename, ".tex", ".pdf", 1)
- cmd := fmt.Sprintf("cd outtex; %v -interaction=nonstopmode -output-directory='../outpdf' %s; cd ../outpdf; cp %s 'Rechnung%s.pdf'; rm %s_*", binary, inputfilename, mainpdf, cleanString(outputfilename), pref)
+ cmd := fmt.Sprintf("cd %souttex; %v -interaction=nonstopmode -output-directory='../outpdf' %s; cd ../outpdf; cp %s 'Rechnung%s.pdf'; rm %s_*", config.Folder,binary, inputfilename, mainpdf, cleanString(outputfilename), pref)
//fmt.Println(cmd)
//docmd := exec.Command(binary,cmdArgs[0], cmdArgs[1],cmdArgs[2])
docmd := exec.Command("bash", "-c", cmd)