Skip to content

Commit

Permalink
Stat image file to make sure it's present
Browse files Browse the repository at this point in the history
  • Loading branch information
relistan committed Mar 30, 2020
1 parent 229845e commit b969c9f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ type CliConfig struct {
OutputDir *string
}

func checkImageFile(config *invoice.BillingConfig) error {
_, err := os.Stat(config.Business.ImageFile)
return err
}

func main() {
cli := CliConfig{
ConfigFile: kingpin.Flag("config-file", "The YAML config file to use").Short('c').Default("billing.yaml").String(),
Expand Down Expand Up @@ -56,6 +61,12 @@ func main() {
config.Business.SerifFont = serifFont
}

err = checkImageFile(config)
if err != nil {
println(err.Error())
os.Exit(1)
}

bill := invoice.NewBill(config)

err = bill.RenderToFile()
Expand Down

0 comments on commit b969c9f

Please sign in to comment.