On 1/5/22 2:19 PM, Assaf Gordon wrote: >> This is working and in use in Android, and now in busybox, and it would >> simplify >> my regression test suite if coreutils was in sync, so I thought I'd ask if >> you >> were interested. >> > > I personally like the idea (at the very list "-D" will indeed replace > awk for many simple use-cases). > > I'm working on a proof-of-concept (will share later today for feedback > and comments).
Feel free to use any of the new lines in that busybox patch, it was my code and you can relicense it as you like. And the toybox implementation at https://github.com/landley/toybox/blob/master/toys/posix/cut.c is 0BSD so as always, loot freely. > Do you mind sharing your test suite? The relevant file is: https://github.com/landley/toybox/blob/master/tests/cut.test What I did to test busybox was "PATH=/busybox:$PATH TEST_HOST=1 make test_cut" with the attached patch applied to switch a longopt busybox didn't implement to the short option it did, and to yank the "toybox only" annotations on the two -D tests. (Wanting to clean that patch out of my working tree was what reminded me to poke you guys about it, if I remove the "toyonly" without coreutils support I stop being able to regression check my test suite against devuan's host tools...) Busybox took the larger of the two towards the end of: https://git.busybox.net/busybox/tree/testsuite/cut.tests#n68 Don't see anything relevant in the broken-out ones: https://git.busybox.net/busybox/tree/testsuite/cut Thanks, Rob
diff --git a/tests/cut.test b/tests/cut.test index 889fc186..c354b9b2 100755 --- a/tests/cut.test +++ b/tests/cut.test @@ -18,7 +18,7 @@ testcmd "-b overlaps" "-b 1-3,2-5,7-9,9-10 abc.txt" \ "one:to:th\nalphabeta\nthe qick \n" "" "" testcmd "-b encapsulated" "-b 3-8,4-6 abc.txt" "e:two:\npha:be\ne quic\n" \ "" "" -testcmd "-bO overlaps" "--output-delimiter ' ' -b 1-3,2-5,7-9,9-10 abc.txt" \ +testcmd "-bO overlaps" "-O ' ' -b 1-3,2-5,7-9,9-10 abc.txt" \ "one:t o:th\nalpha beta\nthe q ick \n" "" "" testcmd "high-low error" "-b 8-3 abc.txt 2>/dev/null || echo err" "err\n" \ "" "" @@ -36,7 +36,7 @@ toyonly testcmd "-c japan.txt" '-c 3-6,9-12 "$FILES/utf8/japan.txt"' \ toyonly testcmd "-C test1.txt" '-C -1 "$FILES/utf8/test1.txt"' "l̴̗̞̠\n" "" "" # substitute for awk -toyonly testcmd "-DF" "-DF 2,7,5" \ +testcmd "-DF" "-DF 2,7,5" \ "said and your\nare\nis demand. supply\nforecast :\nyou you better,\n\nEm: Took hate\n" "" \ "Bother, said Pooh. It's your husband, and he has a gun. Cheerios are donut seeds. @@ -45,7 +45,7 @@ Weather forecast for tonight : dark. Apple: you can buy better, but you can't pay more. Subcalifragilisticexpialidocious. Auntie Em: Hate you, hate Kansas. Took the dog. Dorothy." -toyonly testcmd "-DF 2" "-DF 7,1,3-6,2-5" \ +testcmd "-DF 2" "-DF 7,1,3-6,2-5" \ "seven one three four five six two three four five\n" "" \ "one two three four five six seven eight nine\n"