Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package fx for openSUSE:Factory checked in at 2025-11-17 12:15:50 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/fx (Old) and /work/SRC/openSUSE:Factory/.fx.new.2061 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "fx" Mon Nov 17 12:15:50 2025 rev:10 rq:1317977 version:39.2.0 Changes: -------- --- /work/SRC/openSUSE:Factory/fx/fx.changes 2025-09-10 20:22:50.134719142 +0200 +++ /work/SRC/openSUSE:Factory/.fx.new.2061/fx.changes 2025-11-17 12:22:18.547064448 +0100 @@ -1,0 +2,9 @@ +Wed Nov 12 18:52:04 UTC 2025 - Martin Hauke <[email protected]> + +- Update to version 39.2.0 + * Improved filtering for streaming mode + * Now it is possible to use ?.value >= 42 filter in streaming + mode. + * Improved map func to work in streaming mode as well. + +------------------------------------------------------------------- Old: ---- fx-39.1.0.tar.gz New: ---- fx-39.2.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ fx.spec ++++++ --- /var/tmp/diff_new_pack.ccAtcQ/_old 2025-11-17 12:22:20.015126356 +0100 +++ /var/tmp/diff_new_pack.ccAtcQ/_new 2025-11-17 12:22:20.023126693 +0100 @@ -18,7 +18,7 @@ Name: fx -Version: 39.1.0 +Version: 39.2.0 Release: 0 Summary: Terminal JSON viewer License: MIT ++++++ fx-39.1.0.tar.gz -> fx-39.2.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fx-39.1.0/help.go new/fx-39.2.0/help.go --- old/fx-39.1.0/help.go 2025-09-07 14:12:30.000000000 +0200 +++ new/fx-39.2.0/help.go 2025-11-12 10:42:09.000000000 +0100 @@ -13,7 +13,6 @@ func usage(keyMap KeyMap) string { title := lipgloss.NewStyle().Bold(true) - pad := lipgloss.NewStyle().PaddingLeft(4) return fmt.Sprintf(` %v Terminal JSON viewer @@ -34,9 +33,7 @@ --toml parse input as TOML --strict strict mode --no-inline disable inlining in output - - %v -%v + --game-of-life play the game of life %v https://fx.wtf @@ -47,8 +44,6 @@ title.Render("fx "+version), title.Render("Usage"), title.Render("Flags"), - title.Render("Key Bindings"), - strings.Join(keyMapInfo(keyMap, pad), "\n"), title.Render("More info"), title.Render("Author"), ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fx-39.1.0/internal/engine/engine.go new/fx-39.2.0/internal/engine/engine.go --- old/fx-39.1.0/internal/engine/engine.go 2025-09-07 14:12:30.000000000 +0200 +++ new/fx-39.2.0/internal/engine/engine.go 2025-11-12 10:42:09.000000000 +0100 @@ -90,7 +90,7 @@ for i := range args { code.WriteString(Transpile(args, i)) } - code.WriteString(" return json\n}\n") + code.WriteString("\n return json\n}\n") vm := NewVM(opts.WriteOut) if _, err := vm.RunString(code.String()); err != nil { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fx-39.1.0/internal/engine/stdlib.js new/fx-39.2.0/internal/engine/stdlib.js --- old/fx-39.1.0/internal/engine/stdlib.js 2025-09-07 14:12:30.000000000 +0200 +++ new/fx-39.2.0/internal/engine/stdlib.js 2025-11-12 10:42:09.000000000 +0100 @@ -16,11 +16,6 @@ }, } -const YAML = { - stringify: x => __yaml_stringify__(x), - parse: x => JSON.parse(__yaml_parse__(x)), -} - const skip = Symbol('skip') function apply(fn, ...args) { @@ -45,21 +40,16 @@ throw new Error(`Cannot sort ${typeof x}`) } +function isFalsely(x) { + return x === false || x === null || x === undefined +} + function filter(fn) { return function (x) { if (Array.isArray(x)) { - return x.filter((v, i) => fn(v, i)) - } else if (x !== null && typeof x === 'object') { - const result = {} - for (const [k, v] of Object.entries(x)) { - if (fn(v, k)) { - result[k] = v - } - } - return result - } else { - throw new Error(`Cannot filter ${typeof x}`) + return x.filter((v, i) => !isFalsely(fn(v, i))) } + return isFalsely(fn(x))? skip : x } } @@ -67,15 +57,8 @@ return function (x) { if (Array.isArray(x)) { return x.map((v, i) => fn(v, i)) - } else if (x !== null && typeof x === 'object') { - const result = {} - for (const [k, v] of Object.entries(x)) { - result[k] = fn(v, k) - } - return result - } else { - throw new Error(`Cannot map over ${typeof x}`) } + return fn(x) } } @@ -180,3 +163,8 @@ function fromBase64(x) { return __fromBase64__(x) } + +const YAML = { + stringify: x => __yaml_stringify__(x), + parse: x => JSON.parse(__yaml_parse__(x)), +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fx-39.1.0/internal/engine/transpile.go new/fx-39.2.0/internal/engine/transpile.go --- old/fx-39.1.0/internal/engine/transpile.go 2025-09-07 14:12:30.000000000 +0200 +++ new/fx-39.2.0/internal/engine/transpile.go 2025-11-12 10:42:09.000000000 +0100 @@ -10,7 +10,8 @@ func Transpile(args []string, i int) string { jsCode := transpile(args[i]) snippet := formatErr(args, i, jsCode) - return fmt.Sprintf(` try { + return fmt.Sprintf(` + try { json = apply((function () { const x = this return %s @@ -19,6 +20,7 @@ throw %s } + if (json === skip) return skip `, jsCode, strconv.Quote(snippet)+" + e.toString()") } @@ -49,12 +51,12 @@ if reAt.MatchString(code) { jsCode := transpile(code[1:]) - return fmt.Sprintf(`x.map((x, i) => apply(%s, x, i))`, jsCode) + return fmt.Sprintf(`map((x, i) => apply(%s, x, i))`, jsCode) } if reFilter.MatchString(code) { jsCode := transpile(code[1:]) - return fmt.Sprintf(`x.filter((x, i) => apply(%s, x, i))`, jsCode) + return fmt.Sprintf(`filter((x, i) => apply(%s, x, i))`, jsCode) } return code diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fx-39.1.0/internal/engine/transpile_test.go new/fx-39.2.0/internal/engine/transpile_test.go --- old/fx-39.1.0/internal/engine/transpile_test.go 2025-09-07 14:12:30.000000000 +0200 +++ new/fx-39.2.0/internal/engine/transpile_test.go 2025-11-12 10:42:09.000000000 +0100 @@ -13,8 +13,8 @@ {".foo", "x.foo"}, {".[0]", "x[0]"}, {"foo", "foo"}, - {"@.baz", "x.map((x, i) => apply(x.baz, x, i))"}, - {"?.foo > 42", "x.filter((x, i) => apply(x.foo > 42, x, i))"}, + {"@.baz", "map((x, i) => apply(x.baz, x, i))"}, + {"?.foo > 42", "filter((x, i) => apply(x.foo > 42, x, i))"}, {".foo[].bar[]", "(x => x.foo.flatMap(x => x.bar.flatMap(x => x)))(x)"}, } for _, tt := range tests { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fx-39.1.0/internal/utils/life.go new/fx-39.2.0/internal/utils/life.go --- old/fx-39.1.0/internal/utils/life.go 1970-01-01 01:00:00.000000000 +0100 +++ new/fx-39.2.0/internal/utils/life.go 2025-11-12 10:42:09.000000000 +0100 @@ -0,0 +1,199 @@ +package utils + +import ( + "bufio" + "fmt" + "math/rand" + "os" + "os/signal" + "time" + + "github.com/charmbracelet/x/term" +) + +func GameOfLife() { + w, rows, err := term.GetSize(os.Stdout.Fd()) + if err != nil || w <= 0 || rows <= 0 { + w, rows = 80, 24 + } + h := rows * 2 + size := w * h + s := make([]bool, size) + + switch rand.Int() % 3 { + case 0: + for i := 0; i < size; i++ { + if rand.Float64() < 0.16 { + s[i] = true + } + } + case 1: + cx := w/2 - 6 + cy := h/2 - 7 + s[cx+1+(2+cy)*w] = true + s[cx+2+(1+cy)*w] = true + s[cx+2+(3+cy)*w] = true + s[cx+3+(2+cy)*w] = true + s[cx+5+(15+cy)*w] = true + s[cx+6+(13+cy)*w] = true + s[cx+6+(15+cy)*w] = true + s[cx+7+(12+cy)*w] = true + s[cx+7+(13+cy)*w] = true + s[cx+7+(15+cy)*w] = true + s[cx+9+(11+cy)*w] = true + s[cx+9+(12+cy)*w] = true + s[cx+9+(13+cy)*w] = true + case 2: + s[1+5*w] = true + s[1+6*w] = true + s[2+5*w] = true + s[2+6*w] = true + s[12+5*w] = true + s[12+6*w] = true + s[12+7*w] = true + s[13+4*w] = true + s[13+8*w] = true + s[14+3*w] = true + s[14+9*w] = true + s[15+4*w] = true + s[15+8*w] = true + s[16+5*w] = true + s[16+6*w] = true + s[16+7*w] = true + s[17+5*w] = true + s[17+6*w] = true + s[17+7*w] = true + s[22+3*w] = true + s[22+4*w] = true + s[22+5*w] = true + s[23+2*w] = true + s[23+3*w] = true + s[23+5*w] = true + s[23+6*w] = true + s[24+2*w] = true + s[24+3*w] = true + s[24+5*w] = true + s[24+6*w] = true + s[25+2*w] = true + s[25+3*w] = true + s[25+4*w] = true + s[25+5*w] = true + s[25+6*w] = true + s[26+w] = true + s[26+2*w] = true + s[26+6*w] = true + s[26+7*w] = true + s[35+3*w] = true + s[35+4*w] = true + s[36+3*w] = true + s[36+4*w] = true + } + + out := bufio.NewWriter(os.Stdout) + + esc := func(codes ...string) { + for _, c := range codes { + fmt.Fprintf(out, "\x1b[%s", c) + } + } + + esc("2J", "?25l") + + sigc := make(chan os.Signal, 1) + signal.Notify(sigc, os.Interrupt) + go func() { + <-sigc + esc("?25h") + out.Flush() + fmt.Printf("\n") + os.Exit(2) + }() + + at := func(i, j int) bool { + if i < 0 { + i = h - 1 + } + if i >= h { + i = 0 + } + if j < 0 { + j = w - 1 + } + if j >= w { + j = 0 + } + return s[i*w+j] + } + + fullBlock := "\u2588" + topHalf := "\u2580" + botHalf := "\u2584" + + ticker := time.NewTicker(30 * time.Millisecond) + defer ticker.Stop() + + for { + <-ticker.C + + esc("H") + + gen := make([]bool, size) + for i := h - 1; i >= 0; i-- { + for j := w - 1; j >= 0; j-- { + n := 0 + if at(i-1, j-1) { + n++ + } + if at(i-1, j) { + n++ + } + if at(i-1, j+1) { + n++ + } + if at(i, j-1) { + n++ + } + if at(i, j+1) { + n++ + } + if at(i+1, j-1) { + n++ + } + if at(i+1, j) { + n++ + } + if at(i+1, j+1) { + n++ + } + z := i*w + j + if s[z] { + gen[z] = n == 2 || n == 3 + } else { + gen[z] = n == 3 + } + } + } + s = gen + + for i := 0; i < rows; i++ { + for j := 0; j < w; j++ { + top := s[i*2*w+j] + bot := s[(i*2+1)*w+j] + switch { + case top && bot: + out.WriteString(fullBlock) + case top && !bot: + out.WriteString(topHalf) + case !top && bot: + out.WriteString(botHalf) + default: + out.WriteByte(' ') + } + } + if i != rows-1 { + out.WriteByte('\n') + } + } + out.Flush() + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fx-39.1.0/main.go new/fx-39.2.0/main.go --- old/fx-39.1.0/main.go 2025-09-07 14:12:30.000000000 +0200 +++ new/fx-39.2.0/main.go 2025-11-12 10:42:09.000000000 +0100 @@ -122,6 +122,9 @@ flagStrict = true case "--no-inline": flagNoInline = true + case "--game-of-life": + utils.GameOfLife() + return default: args = append(args, arg) } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fx-39.1.0/npm/index.js new/fx-39.2.0/npm/index.js --- old/fx-39.1.0/npm/index.js 2025-09-07 14:12:30.000000000 +0200 +++ new/fx-39.2.0/npm/index.js 2025-11-12 10:42:09.000000000 +0100 @@ -73,6 +73,7 @@ return ${jsCode} })` output = await run(output, fn) + if (output === skip) break } catch (err) { await printErr(err) } @@ -125,12 +126,12 @@ if (/^@/.test(code)) { const jsCode = transpile(code.substring(1)) - return `x.map((x, i) => apply(${jsCode}, x, i))` + return `map((x, i) => apply(${jsCode}, x, i))` } if (/^\?/.test(code)) { const jsCode = transpile(code.substring(1)) - return `x.filter((x, i) => apply(${jsCode}, x, i))` + return `filter((x, i) => apply(${jsCode}, x, i))` } return code @@ -164,21 +165,16 @@ throw new Error(`Cannot sort ${typeof x}`) } + function isFalsely(x) { + return x === false || x === null || x === undefined + } + function filter(fn) { return function (x) { if (Array.isArray(x)) { - return x.filter((v, i) => fn(v, i)) - } else if (x !== null && typeof x === 'object') { - const result = {} - for (const [k, v] of Object.entries(x)) { - if (fn(v, k)) { - result[k] = v - } - } - return result - } else { - throw new Error(`Cannot filter ${typeof x}`) + return x.filter((v, i) => !isFalsely(fn(v, i))) } + return isFalsely(fn(x))? skip : x } } @@ -186,15 +182,8 @@ return function (x) { if (Array.isArray(x)) { return x.map((v, i) => fn(v, i)) - } else if (x !== null && typeof x === 'object') { - const result = {} - for (const [k, v] of Object.entries(x)) { - result[k] = fn(v, k) - } - return result - } else { - throw new Error(`Cannot map over ${typeof x}`) } + return fn(x) } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fx-39.1.0/npm/package.json new/fx-39.2.0/npm/package.json --- old/fx-39.1.0/npm/package.json 2025-09-07 14:12:30.000000000 +0200 +++ new/fx-39.2.0/npm/package.json 2025-11-12 10:42:09.000000000 +0100 @@ -1,6 +1,6 @@ { "name": "fx", - "version": "39.1.0", + "version": "39.2.0", "bin": { "fx": "index.js" }, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fx-39.1.0/snap/snapcraft.yaml new/fx-39.2.0/snap/snapcraft.yaml --- old/fx-39.1.0/snap/snapcraft.yaml 2025-09-07 14:12:30.000000000 +0200 +++ new/fx-39.2.0/snap/snapcraft.yaml 2025-11-12 10:42:09.000000000 +0100 @@ -1,5 +1,5 @@ name: fx -version: 39.1.0 +version: 39.2.0 summary: Terminal JSON viewer description: Terminal JSON viewer base: core20 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fx-39.1.0/version.go new/fx-39.2.0/version.go --- old/fx-39.1.0/version.go 2025-09-07 14:12:30.000000000 +0200 +++ new/fx-39.2.0/version.go 2025-11-12 10:42:09.000000000 +0100 @@ -1,3 +1,3 @@ package main -const version = "39.1.0" +const version = "39.2.0" ++++++ vendor.tar.gz ++++++
