Add compare and tui commands with shared sort/filter CLI wiring
- add pubcli compare command to rank nearby stores by filtered deal coverage, bogo count, aggregate score, and distance tie-breaks - support --count (1-10) for comparison breadth and emit structured JSON/text output with ranked entries - add robust distance token parsing to tolerate upstream distance string formatting differences - add pubcli tui interactive terminal browser with paging, deal detail drill-in, and explicit TTY validation for stdin/stdout - share deal-filter flag registration across root/tui/compare and add --sort support in root execution path - validate sort mode early and allow canonical aliases (end, expiry, expiration) while preserving explicit invalid-arg guidance - expand tolerant CLI normalization for new commands/flags and aliases (orderby, sortby, count, bare-flag rewrite for compare/tui) - update quick-start flag list and integration tests to cover compare help and normalization behavior
This commit is contained in:
@@ -240,12 +240,12 @@ func shouldAutoJSON(args []string, stdoutIsTTY bool) bool {
|
||||
|
||||
// knownShorthands maps single-character shorthands to whether they require a value.
|
||||
var knownShorthands = map[byte]bool{
|
||||
's': true, // --store
|
||||
'z': true, // --zip
|
||||
'c': true, // --category
|
||||
'd': true, // --department
|
||||
'q': true, // --query
|
||||
'n': true, // --limit
|
||||
's': true, // --store
|
||||
'z': true, // --zip
|
||||
'c': true, // --category
|
||||
'd': true, // --department
|
||||
'q': true, // --query
|
||||
'n': true, // --limit
|
||||
}
|
||||
|
||||
func firstCommand(args []string) string {
|
||||
@@ -299,7 +299,7 @@ func printQuickStart(w io.Writer, asJSON bool) error {
|
||||
|
||||
_, err := fmt.Fprintf(
|
||||
w,
|
||||
"%s\nusage: %s\nexamples:\n %s\n %s\n %s\nflags: --zip --store --json --bogo --category --department --query --limit\n",
|
||||
"%s\nusage: %s\nexamples:\n %s\n %s\n %s\nflags: --zip --store --json --bogo --category --department --query --sort --limit\n",
|
||||
help.Name,
|
||||
help.Usage,
|
||||
help.Examples[0],
|
||||
|
||||
Reference in New Issue
Block a user