diff options
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/lulu/cost.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/cmd/lulu/cost.go b/cmd/lulu/cost.go index 26f641e..1ef655d 100644 --- a/cmd/lulu/cost.go +++ b/cmd/lulu/cost.go @@ -15,14 +15,14 @@ import ( type CostCmd struct { ShippingAddress - Ship lulu.ShippingLevel `required help:"${ship_level_help}"` - Items []PrintJobCostLineItem `required help:"${cost_item_help}"` + Ship lulu.ShippingLevel `required help:"${ship_level_help}"` + Items []CostLineItem `required help:"${cost_item_help}"` } func (cmd *CostCmd) Run(cli *kong.Kong, clnt *lulu.Client) error { - items := make([]lulu.PrintJobCostLineItem, len(cmd.Items)) + items := make([]lulu.CostLineItem, len(cmd.Items)) for i := range cmd.Items { - items[i] = cmd.Items[i].PrintJobCostLineItem + items[i] = cmd.Items[i].CostLineItem } cost, addrVal, err := clnt.Cost(items, cmd.ShippingAddress.Addr(), cmd.Ship) if err != nil { @@ -42,11 +42,11 @@ func (cmd *CostCmd) Run(cli *kong.Kong, clnt *lulu.Client) error { return w.Flush() } -type PrintJobCostLineItem struct { - lulu.PrintJobCostLineItem +type CostLineItem struct { + lulu.CostLineItem } -func (item *PrintJobCostLineItem) UnmarshalText(text []byte) error { +func (item *CostLineItem) UnmarshalText(text []byte) error { s := string(text) groups := printJobCostLineItemExpr.FindStringSubmatch(s) if len(groups) != 3+1 { @@ -72,7 +72,7 @@ func (item *PrintJobCostLineItem) UnmarshalText(text []byte) error { return nil } -func printCost(w io.Writer, cost lulu.PrintJobCost) { +func printCost(w io.Writer, cost lulu.Cost) { for _, fee := range cost.Fees { fmt.Fprintf(w, "fee %s %s:\t%s %s\t\n", fee.Type, fee.Sku, fee.TotalCostExclTax, fee.Currency) } |