aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorSam Anthony <sam@samanthony.xyz>2026-05-15 16:59:37 -0400
committerSam Anthony <sam@samanthony.xyz>2026-05-15 16:59:37 -0400
commitc399982dafee317bc34fb74a94a72218692982c9 (patch)
treec18e55c57960880e88d37edfc6bb1453ec2727da /cmd
parentc40f4cb46b6e24d764ee98c22b5dc4bbd4e07ad5 (diff)
downloadlulu-c399982dafee317bc34fb74a94a72218692982c9.zip
cli: clean up tests and documentation
Diffstat (limited to 'cmd')
-rw-r--r--cmd/lulu/cd.go2
-rw-r--r--cmd/lulu/cli.go20
-rw-r--r--cmd/lulu/cost.go2
-rwxr-xr-xcmd/lulu/test1
-rw-r--r--cmd/lulu/testchecks/cost2
-rw-r--r--cmd/lulu/tests/cd2
-rw-r--r--cmd/lulu/tests/cd_nomfg2
-rw-r--r--cmd/lulu/tests/vc2
-rw-r--r--cmd/lulu/tests/vi5
-rw-r--r--cmd/lulu/tests/vi_basic2
-rw-r--r--cmd/lulu/tests/vi_wrongsize2
-rw-r--r--cmd/lulu/vc.go2
12 files changed, 20 insertions, 24 deletions
diff --git a/cmd/lulu/cd.go b/cmd/lulu/cd.go
index aaefaa0..8af670e 100644
--- a/cmd/lulu/cd.go
+++ b/cmd/lulu/cd.go
@@ -8,7 +8,7 @@ import (
type CoverDimensionsCmd struct {
Mfg lulu.PkgId `arg help:"${mfg_help}"`
- NPages uint `arg name:"npages" help:"Number of interior pages"`
+ NPages uint `arg name:"npages" help:"${npages_help}"`
Unit lulu.Unit `short:"u" default:"pt" help:"${unit_help}"`
}
diff --git a/cmd/lulu/cli.go b/cmd/lulu/cli.go
index b791d1f..ce4b0c9 100644
--- a/cmd/lulu/cli.go
+++ b/cmd/lulu/cli.go
@@ -10,8 +10,10 @@ import (
)
var helpVars = kong.Vars{
- "mfg_help": "Manufacturing settings. Run 'lulu list mfg' for valid values",
- "ship_level_help": "Shipping speed. Run 'lulu list ship' for valid values",
+ "mfg_help": "Manufacturing settings. Run 'lulu list mfg' for format",
+ "ship_level_help": fmt.Sprint(lulu.ShippingLevelValues()),
+ "cost_item_help": "Line items. Run 'lulu list cost-item' for format",
+ "npages_help": "Number of interior pages",
"unit_help": fmt.Sprintf("Unit of measurement: %s", lulu.UnitValues()),
"default_timeout": defaultTimeout.String(),
}
@@ -19,9 +21,9 @@ var helpVars = kong.Vars{
type CLI struct {
Globals
- ValidateInterior ValidateInteriorCmd `cmd name:"vi" help:"Validate an interior file"`
- ValidateCover ValidateCoverCmd `cmd name:"vc" help:"Validate a cover file"`
- CoverDimensions CoverDimensionsCmd `cmd name:"cd" help:"Calculate the required dimensions of the cover"`
+ ValidateInterior ValidateInteriorCmd `cmd name:"vi" help:"Validate interior file"`
+ ValidateCover ValidateCoverCmd `cmd name:"vc" help:"Validate cover file"`
+ CoverDimensions CoverDimensionsCmd `cmd name:"cd" help:"Calculate cover dimensions"`
Cost CostCmd `cmd help:"Calculate the cost of a print job"`
List ListCmd `cmd help:"Print a list of valid argument values"`
@@ -35,7 +37,6 @@ type Globals struct {
type ListCmd struct {
Mfg ListMfgCmd `cmd help:"List <mfg> format"`
- Ship ListShipCmd `cmd help:"List --ship values"`
CostItem ListCostItemCmd `cmd help:"List cost --items format"`
}
@@ -56,13 +57,6 @@ Foil: %s
return nil
}
-type ListShipCmd struct{}
-
-func (l ListShipCmd) Run() error {
- fmt.Printf("--ship=%v\n", lulu.ShippingLevelValues())
- return nil
-}
-
type ListCostItemCmd struct{}
func (l ListCostItemCmd) Run() error {
diff --git a/cmd/lulu/cost.go b/cmd/lulu/cost.go
index 0f9a142..8599340 100644
--- a/cmd/lulu/cost.go
+++ b/cmd/lulu/cost.go
@@ -26,7 +26,7 @@ E.g., "10x_0600X0900.BW.STD.PB.060UW444.MXX_p250" is 10 copies with these manufa
type CostCmd struct {
ShippingAddress
Ship lulu.ShippingLevel `required help:"${ship_level_help}"`
- Items []PrintJobCostLineItem `required help:"Line items. Run 'lulu list cost-item' for valid values"`
+ Items []PrintJobCostLineItem `required help:"${cost_item_help}"`
}
func (cmd *CostCmd) Run(cli *kong.Kong, clnt *lulu.Client) error {
diff --git a/cmd/lulu/test b/cmd/lulu/test
index 375cc95..8c29a2f 100755
--- a/cmd/lulu/test
+++ b/cmd/lulu/test
@@ -7,6 +7,7 @@ set -u
for test in tests/*
do
+ echo $test...
base=${test##*/}
want=testdata/$base
check=testchecks/$base
diff --git a/cmd/lulu/testchecks/cost b/cmd/lulu/testchecks/cost
index 4813c81..47eac29 100644
--- a/cmd/lulu/testchecks/cost
+++ b/cmd/lulu/testchecks/cost
@@ -1 +1 @@
-grep '^total: [1-9][0-9]*(\.[0-9]+)? [A-Z]{3}$' <$1
+grep -E '^total: [1-9][0-9]*(\.[0-9]+)? [A-Z]{3}$' <$1
diff --git a/cmd/lulu/tests/cd b/cmd/lulu/tests/cd
index 16520fc..d7e8e84 100644
--- a/cmd/lulu/tests/cd
+++ b/cmd/lulu/tests/cd
@@ -1 +1 @@
-lulu -s cd -mfg 0583X0827.BW.PRE.PB.060UW444.MXX -n 67 -u mm
+lulu -s cd 0583X0827.BW.PRE.PB.060UW444.MXX 67 -u mm
diff --git a/cmd/lulu/tests/cd_nomfg b/cmd/lulu/tests/cd_nomfg
deleted file mode 100644
index 8404fed..0000000
--- a/cmd/lulu/tests/cd_nomfg
+++ /dev/null
@@ -1,2 +0,0 @@
-# missing -mfg
-lulu -s cd -n 200
diff --git a/cmd/lulu/tests/vc b/cmd/lulu/tests/vc
index f5859d3..5a0a0d4 100644
--- a/cmd/lulu/tests/vc
+++ b/cmd/lulu/tests/vc
@@ -1 +1 @@
-lulu -s vc -mfg 0600X0900.BW.STD.PB.060UW444.MXX -url 'https://www.dropbox.com/sh/p3zh22vzsaegiri/AADP367j0bTWlt8fCu-_tm2ia/161025/139056_cover.pdf?dl=1' -n 210
+lulu -s vc 'https://www.dropbox.com/sh/p3zh22vzsaegiri/AADP367j0bTWlt8fCu-_tm2ia/161025/139056_cover.pdf?dl=1' 0600X0900.BW.STD.PB.060UW444.MXX 210
diff --git a/cmd/lulu/tests/vi b/cmd/lulu/tests/vi
index 5ca8cc9..11050cf 100644
--- a/cmd/lulu/tests/vi
+++ b/cmd/lulu/tests/vi
@@ -1 +1,4 @@
-lulu -s vi -mfg 0600X0900.BW.PRE.PB.060UW444.MXX -url 'https://www.dropbox.com/sh/p3zh22vzsaegiri/AACOUn3LFKsITDzylh13bQpsa/161025/thesis2.pdf?dl=1' -t 30s
+lulu -s vi \
+ 'https://www.dropbox.com/sh/p3zh22vzsaegiri/AACOUn3LFKsITDzylh13bQpsa/161025/thesis2.pdf?dl=1' \
+ 0600X0900.BW.PRE.PB.060UW444.MXX \
+ -t 30s
diff --git a/cmd/lulu/tests/vi_basic b/cmd/lulu/tests/vi_basic
index 78cc8a8..f89cc25 100644
--- a/cmd/lulu/tests/vi_basic
+++ b/cmd/lulu/tests/vi_basic
@@ -1 +1 @@
-lulu -s vi -basic -url 'https://www.dropbox.com/sh/p3zh22vzsaegiri/AACOUn3LFKsITDzylh13bQpsa/161025/thesis2.pdf?dl=1'
+lulu -s vi basic 'https://www.dropbox.com/sh/p3zh22vzsaegiri/AACOUn3LFKsITDzylh13bQpsa/161025/thesis2.pdf?dl=1'
diff --git a/cmd/lulu/tests/vi_wrongsize b/cmd/lulu/tests/vi_wrongsize
index b6932af..380a486 100644
--- a/cmd/lulu/tests/vi_wrongsize
+++ b/cmd/lulu/tests/vi_wrongsize
@@ -1,2 +1,2 @@
# should fail with "The book size you selected does not match the page size in the file you uploaded"
-lulu -s vi -mfg 0583X0827.BW.PRE.PB.060UW444.MXX -url https://www.dropbox.com/sh/p3zh22vzsaegiri/AACOUn3LFKsITDzylh13bQpsa/161025/thesis2.pdf?dl=1
+lulu -s vi 'https://www.dropbox.com/sh/p3zh22vzsaegiri/AACOUn3LFKsITDzylh13bQpsa/161025/thesis2.pdf?dl=1' 0583X0827.BW.PRE.PB.060UW444.MXX
diff --git a/cmd/lulu/vc.go b/cmd/lulu/vc.go
index 4801af9..5a2a84f 100644
--- a/cmd/lulu/vc.go
+++ b/cmd/lulu/vc.go
@@ -14,7 +14,7 @@ import (
type ValidateCoverCmd struct {
Url *url.URL `arg help:"Location of cover file"`
Mfg lulu.PkgId `arg help:"${mfg_help}"`
- NPages uint `arg name:"npages" help:"Number of interior pages"`
+ NPages uint `arg name:"npages" help:"${npages_help}"`
Timeout time.Duration `short:"t" default:"${default_timeout}"`
}