@fnndsc/brasa 0.57.3 → 0.58.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/models.d.ts +2 -3
- package/dist/api/models.js.map +1 -1
- package/dist/buildinfo.json +1 -1
- package/dist/builtins/argumentTokens.js +25 -6
- package/dist/builtins/argumentTokens.js.map +1 -1
- package/dist/builtins/berth/berth.d.ts +0 -14
- package/dist/builtins/berth/berth.js +255 -88
- package/dist/builtins/berth/berth.js.map +1 -1
- package/dist/builtins/berth/berthClose.d.ts +66 -1
- package/dist/builtins/berth/berthClose.js +312 -26
- package/dist/builtins/berth/berthClose.js.map +1 -1
- package/dist/builtins/berth/berthClosed.d.ts +212 -0
- package/dist/builtins/berth/berthClosed.js +231 -0
- package/dist/builtins/berth/berthClosed.js.map +1 -0
- package/dist/builtins/berth/berthCube.js +27 -6
- package/dist/builtins/berth/berthCube.js.map +1 -1
- package/dist/builtins/berth/berthDisk.js +1 -1
- package/dist/builtins/berth/berthDisk.js.map +1 -1
- package/dist/builtins/berth/berthProcesses.js +15 -3
- package/dist/builtins/berth/berthProcesses.js.map +1 -1
- package/dist/builtins/berth/berthRecord.d.ts +14 -2
- package/dist/builtins/berth/berthRecord.js +20 -5
- package/dist/builtins/berth/berthRecord.js.map +1 -1
- package/dist/builtins/berth/berthState.d.ts +26 -6
- package/dist/builtins/berth/berthState.js +47 -13
- package/dist/builtins/berth/berthState.js.map +1 -1
- package/dist/builtins/debug.d.ts +0 -8
- package/dist/builtins/debug.js +1 -12
- package/dist/builtins/debug.js.map +1 -1
- package/dist/builtins/executable.js +102 -75
- package/dist/builtins/executable.js.map +1 -1
- package/dist/builtins/feedTotals.js +30 -25
- package/dist/builtins/feedTotals.js.map +1 -1
- package/dist/builtins/fs/acl.args.d.ts +3 -10
- package/dist/builtins/fs/acl.args.js +16 -24
- package/dist/builtins/fs/acl.args.js.map +1 -1
- package/dist/builtins/fs/acl.d.ts +0 -37
- package/dist/builtins/fs/acl.js +36 -58
- package/dist/builtins/fs/acl.js.map +1 -1
- package/dist/builtins/fs/archive.js +25 -9
- package/dist/builtins/fs/archive.js.map +1 -1
- package/dist/builtins/fs/cat.d.ts +0 -16
- package/dist/builtins/fs/cat.js +163 -96
- package/dist/builtins/fs/cat.js.map +1 -1
- package/dist/builtins/fs/cd.js +23 -5
- package/dist/builtins/fs/cd.js.map +1 -1
- package/dist/builtins/fs/configWrite.d.ts +0 -8
- package/dist/builtins/fs/configWrite.js +33 -46
- package/dist/builtins/fs/configWrite.js.map +1 -1
- package/dist/builtins/fs/cp.d.ts +6 -10
- package/dist/builtins/fs/cp.js +83 -86
- package/dist/builtins/fs/cp.js.map +1 -1
- package/dist/builtins/fs/deliveryIntent.d.ts +24 -0
- package/dist/builtins/fs/deliveryIntent.js +182 -0
- package/dist/builtins/fs/deliveryIntent.js.map +1 -0
- package/dist/builtins/fs/deliveryMatch.d.ts +138 -0
- package/dist/builtins/fs/deliveryMatch.js +135 -0
- package/dist/builtins/fs/deliveryMatch.js.map +1 -0
- package/dist/builtins/fs/destination.d.ts +37 -1
- package/dist/builtins/fs/destination.js +80 -0
- package/dist/builtins/fs/destination.js.map +1 -1
- package/dist/builtins/fs/download.d.ts +19 -8
- package/dist/builtins/fs/download.js +142 -72
- package/dist/builtins/fs/download.js.map +1 -1
- package/dist/builtins/fs/du.d.ts +0 -8
- package/dist/builtins/fs/du.js +23 -20
- package/dist/builtins/fs/du.js.map +1 -1
- package/dist/builtins/fs/edit.js +117 -50
- package/dist/builtins/fs/edit.js.map +1 -1
- package/dist/builtins/fs/entries.d.ts +38 -0
- package/dist/builtins/fs/entries.js +48 -1
- package/dist/builtins/fs/entries.js.map +1 -1
- package/dist/builtins/fs/find.d.ts +1 -1
- package/dist/builtins/fs/find.js +462 -271
- package/dist/builtins/fs/find.js.map +1 -1
- package/dist/builtins/fs/ls.d.ts +2 -8
- package/dist/builtins/fs/ls.js +144 -93
- package/dist/builtins/fs/ls.js.map +1 -1
- package/dist/builtins/fs/mkdir.d.ts +2 -7
- package/dist/builtins/fs/mkdir.js +110 -58
- package/dist/builtins/fs/mkdir.js.map +1 -1
- package/dist/builtins/fs/mv.d.ts +7 -10
- package/dist/builtins/fs/mv.js +155 -100
- package/dist/builtins/fs/mv.js.map +1 -1
- package/dist/builtins/fs/pull.js +155 -92
- package/dist/builtins/fs/pull.js.map +1 -1
- package/dist/builtins/fs/pwd.d.ts +0 -7
- package/dist/builtins/fs/pwd.js +0 -12
- package/dist/builtins/fs/pwd.js.map +1 -1
- package/dist/builtins/fs/rm.d.ts +6 -7
- package/dist/builtins/fs/rm.js +364 -174
- package/dist/builtins/fs/rm.js.map +1 -1
- package/dist/builtins/fs/rmdir.d.ts +0 -7
- package/dist/builtins/fs/rmdir.js +40 -21
- package/dist/builtins/fs/rmdir.js.map +1 -1
- package/dist/builtins/fs/touch.d.ts +0 -7
- package/dist/builtins/fs/touch.js +14 -27
- package/dist/builtins/fs/touch.js.map +1 -1
- package/dist/builtins/fs/transferJobs.d.ts +12 -0
- package/dist/builtins/fs/transferJobs.js +19 -0
- package/dist/builtins/fs/transferJobs.js.map +1 -1
- package/dist/builtins/fs/tree.d.ts +0 -8
- package/dist/builtins/fs/tree.js +1 -12
- package/dist/builtins/fs/tree.js.map +1 -1
- package/dist/builtins/fs/upload.d.ts +0 -8
- package/dist/builtins/fs/upload.js +23 -20
- package/dist/builtins/fs/upload.js.map +1 -1
- package/dist/builtins/fs/url.d.ts +14 -2
- package/dist/builtins/fs/url.js +6 -8
- package/dist/builtins/fs/url.js.map +1 -1
- package/dist/builtins/fs/writeReport.d.ts +40 -0
- package/dist/builtins/fs/writeReport.js +71 -0
- package/dist/builtins/fs/writeReport.js.map +1 -0
- package/dist/builtins/fs/xattr.args.d.ts +14 -13
- package/dist/builtins/fs/xattr.args.js +3 -24
- package/dist/builtins/fs/xattr.args.js.map +1 -1
- package/dist/builtins/fs/xattr.d.ts +0 -25
- package/dist/builtins/fs/xattr.js +82 -65
- package/dist/builtins/fs/xattr.js.map +1 -1
- package/dist/builtins/games/bytes.d.ts +0 -55
- package/dist/builtins/games/bytes.js +95 -120
- package/dist/builtins/games/bytes.js.map +1 -1
- package/dist/builtins/games/chimes.d.ts +0 -36
- package/dist/builtins/games/chimes.js +58 -64
- package/dist/builtins/games/chimes.js.map +1 -1
- package/dist/builtins/games/chrislab.d.ts +0 -12
- package/dist/builtins/games/chrislab.js +0 -14
- package/dist/builtins/games/chrislab.js.map +1 -1
- package/dist/builtins/games/cowsay.d.ts +0 -24
- package/dist/builtins/games/cowsay.js +0 -29
- package/dist/builtins/games/cowsay.js.map +1 -1
- package/dist/builtins/games/figlet.d.ts +0 -24
- package/dist/builtins/games/figlet.js +0 -29
- package/dist/builtins/games/figlet.js.map +1 -1
- package/dist/builtins/games/lab.d.ts +0 -36
- package/dist/builtins/games/lab.js +0 -43
- package/dist/builtins/games/lab.js.map +1 -1
- package/dist/builtins/games/lolcat.d.ts +0 -12
- package/dist/builtins/games/lolcat.js +2 -17
- package/dist/builtins/games/lolcat.js.map +1 -1
- package/dist/builtins/games/numbers.d.ts +0 -60
- package/dist/builtins/games/numbers.js +0 -71
- package/dist/builtins/games/numbers.js.map +1 -1
- package/dist/builtins/games/play.d.ts +0 -36
- package/dist/builtins/games/play.js +47 -58
- package/dist/builtins/games/play.js.map +1 -1
- package/dist/builtins/games/qr.d.ts +0 -12
- package/dist/builtins/games/qr.js +189 -68
- package/dist/builtins/games/qr.js.map +1 -1
- package/dist/builtins/games/show.d.ts +0 -73
- package/dist/builtins/games/show.js +0 -85
- package/dist/builtins/games/show.js.map +1 -1
- package/dist/builtins/games/sky.d.ts +0 -36
- package/dist/builtins/games/sky.js +25 -45
- package/dist/builtins/games/sky.js.map +1 -1
- package/dist/builtins/games/text.d.ts +0 -72
- package/dist/builtins/games/text.js +0 -85
- package/dist/builtins/games/text.js.map +1 -1
- package/dist/builtins/games/trek.d.ts +0 -12
- package/dist/builtins/games/trek.js +0 -15
- package/dist/builtins/games/trek.js.map +1 -1
- package/dist/builtins/games/wtf.d.ts +0 -12
- package/dist/builtins/games/wtf.js +0 -15
- package/dist/builtins/games/wtf.js.map +1 -1
- package/dist/builtins/help.d.ts +0 -19
- package/dist/builtins/help.js +56 -39
- package/dist/builtins/help.js.map +1 -1
- package/dist/builtins/helpSections.js +13 -1
- package/dist/builtins/helpSections.js.map +1 -1
- package/dist/builtins/index.d.ts +1 -1
- package/dist/builtins/index.js +1 -1
- package/dist/builtins/index.js.map +1 -1
- package/dist/builtins/net/connect.d.ts +1 -8
- package/dist/builtins/net/connect.js +2 -13
- package/dist/builtins/net/connect.js.map +1 -1
- package/dist/builtins/net/cubepath.js +30 -20
- package/dist/builtins/net/cubepath.js.map +1 -1
- package/dist/builtins/net/logout.d.ts +0 -8
- package/dist/builtins/net/logout.js +1 -12
- package/dist/builtins/net/logout.js.map +1 -1
- package/dist/builtins/net/netstat.d.ts +0 -8
- package/dist/builtins/net/netstat.js +1 -12
- package/dist/builtins/net/netstat.js.map +1 -1
- package/dist/builtins/net/pacs.d.ts +3 -17
- package/dist/builtins/net/pacs.js +50 -42
- package/dist/builtins/net/pacs.js.map +1 -1
- package/dist/builtins/net/pacsUtils.d.ts +0 -2
- package/dist/builtins/net/pacsUtils.js +67 -30
- package/dist/builtins/net/pacsUtils.js.map +1 -1
- package/dist/builtins/net/query.anon.d.ts +61 -0
- package/dist/builtins/net/query.anon.js +362 -0
- package/dist/builtins/net/query.anon.js.map +1 -0
- package/dist/builtins/net/query.args.d.ts +2 -1
- package/dist/builtins/net/query.args.js +1 -1
- package/dist/builtins/net/query.args.js.map +1 -1
- package/dist/builtins/net/query.cohort.d.ts +125 -0
- package/dist/builtins/net/query.cohort.js +267 -0
- package/dist/builtins/net/query.cohort.js.map +1 -0
- package/dist/builtins/net/query.csv.d.ts +26 -5
- package/dist/builtins/net/query.csv.js +61 -115
- package/dist/builtins/net/query.csv.js.map +1 -1
- package/dist/builtins/net/query.d.ts +27 -34
- package/dist/builtins/net/query.deliver.d.ts +96 -0
- package/dist/builtins/net/query.deliver.js +188 -0
- package/dist/builtins/net/query.deliver.js.map +1 -0
- package/dist/builtins/net/query.fanout.d.ts +32 -0
- package/dist/builtins/net/query.fanout.js +91 -0
- package/dist/builtins/net/query.fanout.js.map +1 -1
- package/dist/builtins/net/query.held.d.ts +60 -0
- package/dist/builtins/net/query.held.js +125 -0
- package/dist/builtins/net/query.held.js.map +1 -0
- package/dist/builtins/net/query.ignored.d.ts +3 -1
- package/dist/builtins/net/query.ignored.js +9 -3
- package/dist/builtins/net/query.ignored.js.map +1 -1
- package/dist/builtins/net/query.js +360 -634
- package/dist/builtins/net/query.js.map +1 -1
- package/dist/builtins/net/query.model.d.ts +15 -0
- package/dist/builtins/net/query.model.js +109 -46
- package/dist/builtins/net/query.model.js.map +1 -1
- package/dist/builtins/net/query.view.js +29 -8
- package/dist/builtins/net/query.view.js.map +1 -1
- package/dist/builtins/operandRuns.js +4 -3
- package/dist/builtins/operandRuns.js.map +1 -1
- package/dist/builtins/operands.js +97 -39
- package/dist/builtins/operands.js.map +1 -1
- package/dist/builtins/pluginExecute.js +311 -205
- package/dist/builtins/pluginExecute.js.map +1 -1
- package/dist/builtins/proc.d.ts +1 -13
- package/dist/builtins/proc.helpers.d.ts +0 -7
- package/dist/builtins/proc.helpers.js +0 -10
- package/dist/builtins/proc.helpers.js.map +1 -1
- package/dist/builtins/proc.js +159 -116
- package/dist/builtins/proc.js.map +1 -1
- package/dist/builtins/procWatch.d.ts +2 -2
- package/dist/builtins/procWatch.js +54 -13
- package/dist/builtins/procWatch.js.map +1 -1
- package/dist/builtins/res/compute.d.ts +0 -13
- package/dist/builtins/res/compute.js +0 -16
- package/dist/builtins/res/compute.js.map +1 -1
- package/dist/builtins/res/diagram.tree.js +36 -12
- package/dist/builtins/res/diagram.tree.js.map +1 -1
- package/dist/builtins/res/dicom.d.ts +24 -17
- package/dist/builtins/res/dicom.js +78 -79
- package/dist/builtins/res/dicom.js.map +1 -1
- package/dist/builtins/res/expect.d.ts +8 -17
- package/dist/builtins/res/expect.js +173 -101
- package/dist/builtins/res/expect.js.map +1 -1
- package/dist/builtins/res/feed.d.ts +0 -13
- package/dist/builtins/res/feed.diagram.js +89 -57
- package/dist/builtins/res/feed.diagram.js.map +1 -1
- package/dist/builtins/res/feed.js +61 -42
- package/dist/builtins/res/feed.js.map +1 -1
- package/dist/builtins/res/feed.tree.collapse.d.ts +0 -10
- package/dist/builtins/res/feed.tree.collapse.js +12 -5
- package/dist/builtins/res/feed.tree.collapse.js.map +1 -1
- package/dist/builtins/res/files.d.ts +0 -37
- package/dist/builtins/res/files.js +0 -44
- package/dist/builtins/res/files.js.map +1 -1
- package/dist/builtins/res/gather.d.ts +0 -13
- package/dist/builtins/res/gather.facts.js +24 -16
- package/dist/builtins/res/gather.facts.js.map +1 -1
- package/dist/builtins/res/gather.js +47 -36
- package/dist/builtins/res/gather.js.map +1 -1
- package/dist/builtins/res/gather.process.js +49 -15
- package/dist/builtins/res/gather.process.js.map +1 -1
- package/dist/builtins/res/gather.store.d.ts +4 -2
- package/dist/builtins/res/gather.store.js +43 -31
- package/dist/builtins/res/gather.store.js.map +1 -1
- package/dist/builtins/res/group.d.ts +0 -13
- package/dist/builtins/res/group.js +78 -40
- package/dist/builtins/res/group.js.map +1 -1
- package/dist/builtins/res/image.d.ts +0 -13
- package/dist/builtins/res/image.js +0 -15
- package/dist/builtins/res/image.js.map +1 -1
- package/dist/builtins/res/manifestRead.d.ts +65 -0
- package/dist/builtins/res/manifestRead.js +161 -0
- package/dist/builtins/res/manifestRead.js.map +1 -0
- package/dist/builtins/res/pipeline.d.ts +1 -1
- package/dist/builtins/res/pipeline.js +152 -103
- package/dist/builtins/res/pipeline.js.map +1 -1
- package/dist/builtins/res/pipeline.manifest.js +17 -7
- package/dist/builtins/res/pipeline.manifest.js.map +1 -1
- package/dist/builtins/res/play.d.ts +0 -13
- package/dist/builtins/res/play.js +367 -226
- package/dist/builtins/res/play.js.map +1 -1
- package/dist/builtins/res/plugin.d.ts +1 -13
- package/dist/builtins/res/plugin.info.js +36 -14
- package/dist/builtins/res/plugin.info.js.map +1 -1
- package/dist/builtins/res/plugin.js +1 -17
- package/dist/builtins/res/plugin.js.map +1 -1
- package/dist/builtins/res/plugin.sync.d.ts +3 -5
- package/dist/builtins/res/plugin.sync.js +175 -40
- package/dist/builtins/res/plugin.sync.js.map +1 -1
- package/dist/builtins/res/plugininstance.d.ts +0 -13
- package/dist/builtins/res/plugininstance.js +0 -16
- package/dist/builtins/res/plugininstance.js.map +1 -1
- package/dist/builtins/res/pluginmeta.d.ts +0 -13
- package/dist/builtins/res/pluginmeta.js +0 -16
- package/dist/builtins/res/pluginmeta.js.map +1 -1
- package/dist/builtins/res/record.d.ts +0 -13
- package/dist/builtins/res/record.js +2 -18
- package/dist/builtins/res/record.js.map +1 -1
- package/dist/builtins/res/runWait.js +32 -8
- package/dist/builtins/res/runWait.js.map +1 -1
- package/dist/builtins/res/tag.d.ts +0 -13
- package/dist/builtins/res/tag.js +0 -16
- package/dist/builtins/res/tag.js.map +1 -1
- package/dist/builtins/res/thumbnail.js +23 -8
- package/dist/builtins/res/thumbnail.js.map +1 -1
- package/dist/builtins/res/user.d.ts +0 -12
- package/dist/builtins/res/user.js +0 -17
- package/dist/builtins/res/user.js.map +1 -1
- package/dist/builtins/res/workflow.d.ts +0 -13
- package/dist/builtins/res/workflow.js +0 -16
- package/dist/builtins/res/workflow.js.map +1 -1
- package/dist/builtins/runEcho.js +2 -1
- package/dist/builtins/runEcho.js.map +1 -1
- package/dist/builtins/store.d.ts +0 -13
- package/dist/builtins/store.js +32 -32
- package/dist/builtins/store.js.map +1 -1
- package/dist/builtins/sys/apropos.d.ts +2 -27
- package/dist/builtins/sys/apropos.js +2 -32
- package/dist/builtins/sys/apropos.js.map +1 -1
- package/dist/builtins/sys/cal.d.ts +0 -12
- package/dist/builtins/sys/cal.js +0 -15
- package/dist/builtins/sys/cal.js.map +1 -1
- package/dist/builtins/sys/command.js +3 -7
- package/dist/builtins/sys/command.js.map +1 -1
- package/dist/builtins/sys/context.d.ts +0 -8
- package/dist/builtins/sys/context.js +1 -12
- package/dist/builtins/sys/context.js.map +1 -1
- package/dist/builtins/sys/date.d.ts +0 -12
- package/dist/builtins/sys/date.js +0 -15
- package/dist/builtins/sys/date.js.map +1 -1
- package/dist/builtins/sys/echo.d.ts +0 -12
- package/dist/builtins/sys/echo.js +54 -49
- package/dist/builtins/sys/echo.js.map +1 -1
- package/dist/builtins/sys/fortune.d.ts +0 -12
- package/dist/builtins/sys/fortune.js +0 -15
- package/dist/builtins/sys/fortune.js.map +1 -1
- package/dist/builtins/sys/grep.d.ts +14 -18
- package/dist/builtins/sys/grep.js +239 -114
- package/dist/builtins/sys/grep.js.map +1 -1
- package/dist/builtins/sys/hostGrants.d.ts +85 -0
- package/dist/builtins/sys/hostGrants.js +207 -0
- package/dist/builtins/sys/hostGrants.js.map +1 -0
- package/dist/builtins/sys/joblets.d.ts +0 -24
- package/dist/builtins/sys/joblets.js +0 -29
- package/dist/builtins/sys/joblets.js.map +1 -1
- package/dist/builtins/sys/motd.d.ts +0 -12
- package/dist/builtins/sys/motd.js +14 -21
- package/dist/builtins/sys/motd.js.map +1 -1
- package/dist/builtins/sys/notes.js +26 -16
- package/dist/builtins/sys/notes.js.map +1 -1
- package/dist/builtins/sys/physicalmode.d.ts +0 -8
- package/dist/builtins/sys/physicalmode.js +1 -12
- package/dist/builtins/sys/physicalmode.js.map +1 -1
- package/dist/builtins/sys/tasks.d.ts +0 -24
- package/dist/builtins/sys/tasks.js +30 -36
- package/dist/builtins/sys/tasks.js.map +1 -1
- package/dist/builtins/sys/textFilters.d.ts +0 -84
- package/dist/builtins/sys/textFilters.js +33 -110
- package/dist/builtins/sys/textFilters.js.map +1 -1
- package/dist/builtins/sys/timing.d.ts +0 -8
- package/dist/builtins/sys/timing.js +1 -12
- package/dist/builtins/sys/timing.js.map +1 -1
- package/dist/builtins/sys/variables.d.ts +0 -24
- package/dist/builtins/sys/variables.js +0 -29
- package/dist/builtins/sys/variables.js.map +1 -1
- package/dist/builtins/sys/version.d.ts +0 -12
- package/dist/builtins/sys/version.js +0 -15
- package/dist/builtins/sys/version.js.map +1 -1
- package/dist/builtins/sys/weather.js +46 -27
- package/dist/builtins/sys/weather.js.map +1 -1
- package/dist/builtins/sys/whoami.d.ts +0 -22
- package/dist/builtins/sys/whoami.js +16 -43
- package/dist/builtins/sys/whoami.js.map +1 -1
- package/dist/builtins/utils.d.ts +4 -39
- package/dist/builtins/utils.js +24 -55
- package/dist/builtins/utils.js.map +1 -1
- package/dist/chris/backend.js +7 -12
- package/dist/chris/backend.js.map +1 -1
- package/dist/chris/binDeclarations.d.ts +0 -44
- package/dist/chris/binDeclarations.js +111 -29
- package/dist/chris/binDeclarations.js.map +1 -1
- package/dist/chris/binExecutables.js +26 -18
- package/dist/chris/binExecutables.js.map +1 -1
- package/dist/chris/chiliDelegate.d.ts +104 -0
- package/dist/chris/chiliDelegate.js +240 -0
- package/dist/chris/chiliDelegate.js.map +1 -1
- package/dist/chris/commandFallback.d.ts +2 -2
- package/dist/chris/commandFallback.js +107 -50
- package/dist/chris/commandFallback.js.map +1 -1
- package/dist/chris/completion.d.ts +3 -1
- package/dist/chris/completion.js +5 -17
- package/dist/chris/completion.js.map +1 -1
- package/dist/chris/connect.d.ts +37 -0
- package/dist/chris/connect.js +46 -0
- package/dist/chris/connect.js.map +1 -1
- package/dist/chris/files.js +32 -2
- package/dist/chris/files.js.map +1 -1
- package/dist/chris/navigation.js +87 -53
- package/dist/chris/navigation.js.map +1 -1
- package/dist/chris/pacsResources.js +28 -11
- package/dist/chris/pacsResources.js.map +1 -1
- package/dist/chris/promptContext.js +68 -35
- package/dist/chris/promptContext.js.map +1 -1
- package/dist/chris/universeLayout.d.ts +8 -2
- package/dist/chris/universeLayout.js +40 -11
- package/dist/chris/universeLayout.js.map +1 -1
- package/dist/chris/warmup.d.ts +140 -0
- package/dist/chris/warmup.js +622 -0
- package/dist/chris/warmup.js.map +1 -0
- package/dist/core/argumentKinds.js +4 -4
- package/dist/core/argumentKinds.js.map +1 -1
- package/dist/core/assignment.js +8 -6
- package/dist/core/assignment.js.map +1 -1
- package/dist/core/backend.d.ts +44 -8
- package/dist/core/backend.js.map +1 -1
- package/dist/core/commandDeclaration.d.ts +8 -0
- package/dist/core/commandDeclaration.js.map +1 -1
- package/dist/core/commandParse.d.ts +34 -1
- package/dist/core/commandParse.js +156 -28
- package/dist/core/commandParse.js.map +1 -1
- package/dist/core/commandRegistry.d.ts +24 -5
- package/dist/core/commandRegistry.js +28 -5
- package/dist/core/commandRegistry.js.map +1 -1
- package/dist/core/dispatch.d.ts +1 -12
- package/dist/core/dispatch.js +12 -16
- package/dist/core/dispatch.js.map +1 -1
- package/dist/core/elevation.js +30 -5
- package/dist/core/elevation.js.map +1 -1
- package/dist/core/engine.d.ts +5 -11
- package/dist/core/engine.js +126 -50
- package/dist/core/engine.js.map +1 -1
- package/dist/core/expansion.d.ts +0 -6
- package/dist/core/expansion.js +0 -8
- package/dist/core/expansion.js.map +1 -1
- package/dist/core/filesystem.js +1 -1
- package/dist/core/filesystem.js.map +1 -1
- package/dist/core/handlerRun.d.ts +13 -0
- package/dist/core/handlerRun.js +21 -0
- package/dist/core/handlerRun.js.map +1 -1
- package/dist/core/holds.js +3 -3
- package/dist/core/holds.js.map +1 -1
- package/dist/core/hostGate.d.ts +62 -0
- package/dist/core/hostGate.js +72 -0
- package/dist/core/hostGate.js.map +1 -0
- package/dist/core/joblets.js +53 -27
- package/dist/core/joblets.js.map +1 -1
- package/dist/core/paths.d.ts +3 -5
- package/dist/core/paths.js +107 -36
- package/dist/core/paths.js.map +1 -1
- package/dist/core/preprocess.d.ts +12 -0
- package/dist/core/preprocess.js +42 -15
- package/dist/core/preprocess.js.map +1 -1
- package/dist/core/question.d.ts +27 -3
- package/dist/core/question.js +14 -6
- package/dist/core/question.js.map +1 -1
- package/dist/core/runner.d.ts +31 -7
- package/dist/core/runner.js +189 -37
- package/dist/core/runner.js.map +1 -1
- package/dist/core/sink.d.ts +7 -19
- package/dist/core/sink.js +56 -28
- package/dist/core/sink.js.map +1 -1
- package/dist/core/surface.js +1 -0
- package/dist/core/surface.js.map +1 -1
- package/dist/core/variables.js +37 -11
- package/dist/core/variables.js.map +1 -1
- package/dist/core/version.d.ts +0 -20
- package/dist/core/version.js +2 -26
- package/dist/core/version.js.map +1 -1
- package/dist/core/warmupFailures.d.ts +3 -6
- package/dist/core/warmupFailures.js.map +1 -1
- package/dist/core.d.ts +2 -0
- package/dist/core.js +2 -0
- package/dist/core.js.map +1 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/completer/cfsPaths.js +66 -26
- package/dist/lib/completer/cfsPaths.js.map +1 -1
- package/dist/lib/completer/declared.js +81 -20
- package/dist/lib/completer/declared.js.map +1 -1
- package/dist/lib/completer/index.d.ts +3 -0
- package/dist/lib/completer/index.js +44 -7
- package/dist/lib/completer/index.js.map +1 -1
- package/dist/lib/parser.d.ts +0 -16
- package/dist/lib/parser.js +223 -135
- package/dist/lib/parser.js.map +1 -1
- package/dist/lib/vfs/folderListing.d.ts +85 -0
- package/dist/lib/vfs/folderListing.js +86 -0
- package/dist/lib/vfs/folderListing.js.map +1 -0
- package/dist/lib/vfs/vfs.d.ts +37 -9
- package/dist/lib/vfs/vfs.js +195 -110
- package/dist/lib/vfs/vfs.js.map +1 -1
- package/dist/lib/wildcard.d.ts +7 -34
- package/dist/lib/wildcard.js +123 -95
- package/dist/lib/wildcard.js.map +1 -1
- package/dist/notes.json +1 -1
- package/dist/session/answerAdapters.js +249 -131
- package/dist/session/answerAdapters.js.map +1 -1
- package/package.json +12 -10
- package/dist/builtins/wildcard.d.ts +0 -8
- package/dist/builtins/wildcard.js +0 -9
- package/dist/builtins/wildcard.js.map +0 -1
- package/dist/lib/quoting.d.ts +0 -40
- package/dist/lib/quoting.js +0 -70
- package/dist/lib/quoting.js.map +0 -1
- package/dist/lib/semicolonParser.d.ts +0 -41
- package/dist/lib/semicolonParser.js +0 -93
- package/dist/lib/semicolonParser.js.map +0 -1
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
import { FORTUNES } from './fortunes.data.js';
|
|
12
12
|
import { envelope_ok } from '@fnndsc/menu';
|
|
13
13
|
import { command_declare } from '../../core/commandDeclaration.js';
|
|
14
|
-
import { declaredCommand_run } from '../../core/commandParse.js';
|
|
15
14
|
/**
|
|
16
15
|
* Picks a random fortune from the bundled collection.
|
|
17
16
|
*
|
|
@@ -49,20 +48,6 @@ export const fortuneCommand = command_declare({
|
|
|
49
48
|
holds: [],
|
|
50
49
|
handler: async (_args) => fortune_run(),
|
|
51
50
|
});
|
|
52
|
-
/**
|
|
53
|
-
* `fortune` over words already split: the declaration's parse and handler.
|
|
54
|
-
*
|
|
55
|
-
* @param args - The words after `fortune`.
|
|
56
|
-
* @returns A fortune, or the refusal of a bad line.
|
|
57
|
-
*
|
|
58
|
-
* @example
|
|
59
|
-
* ```ts
|
|
60
|
-
* await builtin_fortune([]);
|
|
61
|
-
* ```
|
|
62
|
-
*/
|
|
63
|
-
export async function builtin_fortune(args) {
|
|
64
|
-
return declaredCommand_run(fortuneCommand, args);
|
|
65
|
-
}
|
|
66
51
|
/**
|
|
67
52
|
* Reports a random fortune as a command envelope.
|
|
68
53
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fortune.js","sourceRoot":"","sources":["../../../src/builtins/sys/fortune.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAmB,WAAW,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,eAAe,EAA8C,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"fortune.js","sourceRoot":"","sources":["../../../src/builtins/sys/fortune.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAmB,WAAW,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,eAAe,EAA8C,MAAM,kCAAkC,CAAC;AAE/G;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAAC,QAAiB;IAC9C,MAAM,OAAO,GACX,QAAQ,KAAK,SAAS;QACpB,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAS,EAAW,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,IAAI,QAAQ,CAAC;QAC3E,CAAC,CAAC,QAAQ,CAAC;IACf,MAAM,IAAI,GAAsB,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC;IACxE,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;AACvD,CAAC;AAED,+CAA+C;AAC/C,MAAM,eAAe,GAAG,EAAoC,CAAC;AAE7D;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,eAAe,CAAC;IAC5C,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,eAAe;IACxB,IAAI,EAAE;QACJ,OAAO,EAAE,+BAA+B;QACxC,WAAW,EAAE,wFAAwF;QACrG,QAAQ,EAAE,CAAC,SAAS,CAAC;QACrB,QAAQ,EAAE,OAAO;KAClB;IACD,KAAK,EAAE,EAAE;IACT,OAAO,EAAE,KAAK,EAAE,KAA+C,EAA4B,EAAE,CAAC,WAAW,EAAE;CAC5G,CAAC,CAAC;AAEH;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW;IAC/B,MAAM,OAAO,GAAW,cAAc,EAAE,CAAC;IACzC,OAAO,WAAW,CAAC,GAAG,OAAO,IAAI,EAAE;QACjC,IAAI,EAAE,aAAa;QACnB,IAAI,EAAE,EAAE,OAAO,EAAE;KAClB,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { type FilterSource } from './textFilters.js';
|
|
1
|
+
import type { ShellWord } from '../../lib/parser.js';
|
|
3
2
|
import { type AnswerRow } from '../../session/answer.js';
|
|
3
|
+
import { type FilterSource } from './textFilters.js';
|
|
4
4
|
/**
|
|
5
5
|
* What a grep line asks of a match: the flags that decide which lines (or
|
|
6
6
|
* rows) are kept, and the patterns.
|
|
@@ -32,7 +32,10 @@ export interface GrepAsk {
|
|
|
32
32
|
*
|
|
33
33
|
* @example
|
|
34
34
|
* ```ts
|
|
35
|
-
* const layout: GrepLayout = {
|
|
35
|
+
* const layout: GrepLayout = {
|
|
36
|
+
* lineNumber: true, filesWithMatches: false, onlyMatching: false, noFilename: false, withFilename: false, recursive: false,
|
|
37
|
+
* after: 2, before: undefined, context: undefined, color: undefined,
|
|
38
|
+
* };
|
|
36
39
|
* ```
|
|
37
40
|
*/
|
|
38
41
|
export interface GrepLayout {
|
|
@@ -57,15 +60,6 @@ export interface GrepLayout {
|
|
|
57
60
|
/** -C N, as given. */
|
|
58
61
|
context: number | undefined;
|
|
59
62
|
}
|
|
60
|
-
/**
|
|
61
|
-
* The layout of a grep line that asks none: lines as they are.
|
|
62
|
-
*
|
|
63
|
-
* @example
|
|
64
|
-
* ```ts
|
|
65
|
-
* const layout: GrepLayout = { ...GREP_LAYOUT_PLAIN, onlyMatching: true };
|
|
66
|
-
* ```
|
|
67
|
-
*/
|
|
68
|
-
export declare const GREP_LAYOUT_PLAIN: GrepLayout;
|
|
69
63
|
/**
|
|
70
64
|
* `grep [-ivwEFcnlohr] [-A N] [-B N] [-C N] [-e PATTERN]... [PATTERN] [FILE]...`: the declaration.
|
|
71
65
|
*
|
|
@@ -263,20 +257,22 @@ interface GrepAnswer {
|
|
|
263
257
|
*
|
|
264
258
|
* @example
|
|
265
259
|
* ```ts
|
|
266
|
-
* textSources_grep(/b/, ask,
|
|
260
|
+
* textSources_grep(/b/, ask, layout, [{ name: null, text: 'a\nb\n' }], false).text; // 'b\n'
|
|
267
261
|
* ```
|
|
268
262
|
*/
|
|
269
263
|
export declare function textSources_grep(expression: RegExp, ask: GrepAsk, layout: GrepLayout, sources: ReadonlyArray<FilterSource>, named: boolean): GrepAnswer;
|
|
270
264
|
/**
|
|
271
|
-
*
|
|
265
|
+
* The line a grep segment would hand to the host's grep, when it filters piped text there (`text_grep`): rendered
|
|
266
|
+
* from the segment's own words by the run's own reading and rendering, so it is exactly what the engine would
|
|
267
|
+
* send. Null when the segment would not (files named, recursive, no pattern) or the line does not parse.
|
|
272
268
|
*
|
|
273
|
-
* @param
|
|
274
|
-
* @returns The
|
|
269
|
+
* @param words - The words after `grep`, as the engine tokenizes them.
|
|
270
|
+
* @returns The host line, or null.
|
|
275
271
|
*
|
|
276
272
|
* @example
|
|
277
273
|
* ```ts
|
|
278
|
-
* await
|
|
274
|
+
* await grepHostLine_read(shellWords_tokenize('-i t1')); // 'grep -i t1'
|
|
279
275
|
* ```
|
|
280
276
|
*/
|
|
281
|
-
export declare function
|
|
277
|
+
export declare function grepHostLine_read(words: readonly ShellWord[]): Promise<string | null>;
|
|
282
278
|
export {};
|
|
@@ -20,15 +20,14 @@
|
|
|
20
20
|
*
|
|
21
21
|
* Key components:
|
|
22
22
|
* - grepCommand: the declaration.
|
|
23
|
-
* - builtin_grep: the declaration run over words already split.
|
|
24
23
|
* - grepExpression_build, grepMatcher_build: the expression, and the test a line passes.
|
|
25
24
|
* - textSources_grep: the lines a grep over text writes, as GNU grep writes them.
|
|
26
25
|
* - listingRows_grep: the rows a grep keeps of a listing.
|
|
27
26
|
*
|
|
28
27
|
* Typical usage:
|
|
29
28
|
* ```ts
|
|
30
|
-
* await
|
|
31
|
-
* await
|
|
29
|
+
* await declaredCommand_run(grepCommand, ['-i', 't1']);
|
|
30
|
+
* await declaredCommand_run(grepCommand, ['-c', 'todo', 'notes.txt']);
|
|
32
31
|
* ```
|
|
33
32
|
*
|
|
34
33
|
* Dependencies: the held and piped listings, the session's filesystem (via
|
|
@@ -36,33 +35,23 @@
|
|
|
36
35
|
*
|
|
37
36
|
* @module
|
|
38
37
|
*/
|
|
39
|
-
import chalk from 'chalk';
|
|
40
|
-
import { envelope_ok, envelope_error } from '@fnndsc/menu';
|
|
41
|
-
import { stdin_take } from '../games/stdin.js';
|
|
42
38
|
import { errorStack, errno_words } from '@fnndsc/fond';
|
|
43
|
-
import {
|
|
44
|
-
import
|
|
39
|
+
import { envelope_ok, envelope_error, word_write } from '@fnndsc/menu';
|
|
40
|
+
import chalk from 'chalk';
|
|
41
|
+
import { answerKinds_get } from '../../core/answerKinds.js';
|
|
42
|
+
import { command_declare } from '../../core/commandDeclaration.js';
|
|
43
|
+
import { declaredLine_parse } from '../../core/commandParse.js';
|
|
44
|
+
import { error_stripDebugPrefix } from '../../core/errorText.js';
|
|
45
45
|
import { vfsDispatcher_get } from '../../core/filesystem.js';
|
|
46
|
+
import { exitCode_set } from '../../core/handlerRun.js';
|
|
46
47
|
import { itemType_isContainer } from '../../core/itemKinds.js';
|
|
47
|
-
import { command_declare } from '../../core/commandDeclaration.js';
|
|
48
|
-
import { declaredCommand_run } from '../../core/commandParse.js';
|
|
49
48
|
import { listingIn_take } from '../../core/listing.js';
|
|
50
|
-
import { answerKinds_get } from '../../core/answerKinds.js';
|
|
51
49
|
import { surface_get } from '../../core/surface.js';
|
|
50
|
+
import { folderListing_read } from '../../lib/vfs/folderListing.js';
|
|
52
51
|
import { answer_get, answerFilter_apply, answerNumbering_derive, answerOrdinals_attach, answerRow_key, answerRows_derive, handle_word, numberedFooter_render, } from '../../session/answer.js';
|
|
53
|
-
import {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
*
|
|
57
|
-
* @example
|
|
58
|
-
* ```ts
|
|
59
|
-
* const layout: GrepLayout = { ...GREP_LAYOUT_PLAIN, onlyMatching: true };
|
|
60
|
-
* ```
|
|
61
|
-
*/
|
|
62
|
-
export const GREP_LAYOUT_PLAIN = {
|
|
63
|
-
lineNumber: false, filesWithMatches: false, onlyMatching: false, noFilename: false, withFilename: false, recursive: false,
|
|
64
|
-
after: undefined, before: undefined, context: undefined, color: undefined,
|
|
65
|
-
};
|
|
52
|
+
import { stdin_take } from '../games/stdin.js';
|
|
53
|
+
import { storePath_resolve } from '../utils.js';
|
|
54
|
+
import { filterFile_read, filterRead_answer, filterSources_read, FILES_OPERAND, lines_join, lines_split, } from './textFilters.js';
|
|
66
55
|
/** The switches of a grep line, as the line writes them back. */
|
|
67
56
|
const GREP_SWITCHES = [
|
|
68
57
|
{ letter: 'i', on: (ask) => ask.insensitive },
|
|
@@ -160,12 +149,12 @@ function grepLine_render(ask, layout) {
|
|
|
160
149
|
...(layout.after !== undefined ? ['-A', String(layout.after)] : []),
|
|
161
150
|
...(layout.before !== undefined ? ['-B', String(layout.before)] : []),
|
|
162
151
|
...(layout.context !== undefined ? ['-C', String(layout.context)] : []),
|
|
163
|
-
...(layout.color === undefined ? [] : [layout.color === '' ? '--color' : `--color=${
|
|
152
|
+
...(layout.color === undefined ? [] : [layout.color === '' ? '--color' : `--color=${word_write(layout.color)}`]),
|
|
164
153
|
];
|
|
165
154
|
const lone = ask.patterns.length === 1 ? ask.patterns[0] : undefined;
|
|
166
155
|
const patterns = lone !== undefined && !lone.startsWith('-')
|
|
167
|
-
? [
|
|
168
|
-
: ask.patterns.flatMap((pattern) => ['-e',
|
|
156
|
+
? [word_write(lone)]
|
|
157
|
+
: ask.patterns.flatMap((pattern) => ['-e', word_write(pattern)]);
|
|
169
158
|
return ['grep', ...switches, ...counts, ...patterns].join(' ');
|
|
170
159
|
}
|
|
171
160
|
/**
|
|
@@ -232,6 +221,58 @@ export function grepMatcher_build(ask) {
|
|
|
232
221
|
return built;
|
|
233
222
|
return (text) => built.test(text);
|
|
234
223
|
}
|
|
224
|
+
/**
|
|
225
|
+
* Collects the ancestor rows of `row` by walking `parent` references in `byKey`.
|
|
226
|
+
*
|
|
227
|
+
* @param row - The starting row.
|
|
228
|
+
* @param byKey - Lookup map of rows by their answer key.
|
|
229
|
+
* @returns The ordered chain of ancestor rows.
|
|
230
|
+
*/
|
|
231
|
+
function rowAncestors_collect(row, byKey) {
|
|
232
|
+
const chain = [];
|
|
233
|
+
let parent = row.parent === undefined ? undefined : byKey.get(row.parent);
|
|
234
|
+
while (parent !== undefined && !chain.includes(parent)) {
|
|
235
|
+
chain.push(parent);
|
|
236
|
+
parent = parent.parent === undefined ? undefined : byKey.get(parent.parent);
|
|
237
|
+
}
|
|
238
|
+
return chain;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Adds a row and all of its ancestors to the kept key set.
|
|
242
|
+
*
|
|
243
|
+
* @param kept - The mutable set of kept row keys.
|
|
244
|
+
* @param row - The row to keep.
|
|
245
|
+
* @param byKey - Lookup map of rows by their answer key.
|
|
246
|
+
*/
|
|
247
|
+
function rowWithAncestors_keep(kept, row, byKey) {
|
|
248
|
+
kept.add(answerRow_key(row));
|
|
249
|
+
for (const parent of rowAncestors_collect(row, byKey))
|
|
250
|
+
kept.add(answerRow_key(parent));
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Populates the kept-row key set under inverted (`-v`) matching: uncaught
|
|
254
|
+
* leaf rows keep their ancestor groups, and childless top-level groups stay
|
|
255
|
+
* when not caught.
|
|
256
|
+
*
|
|
257
|
+
* @param kept - The mutable set of kept row keys.
|
|
258
|
+
* @param rows - The listing's rows, in order.
|
|
259
|
+
* @param caught - Predicate testing whether a row or an ancestor matched.
|
|
260
|
+
* @param hasChildren - Set of row keys that appear as another row's `parent`.
|
|
261
|
+
* @param byKey - Lookup map of rows by their answer key.
|
|
262
|
+
*/
|
|
263
|
+
function invertedRows_keep(kept, rows, caught, hasChildren, byKey) {
|
|
264
|
+
for (const row of rows) {
|
|
265
|
+
if (caught(row) || hasChildren.has(answerRow_key(row)))
|
|
266
|
+
continue;
|
|
267
|
+
rowWithAncestors_keep(kept, row, byKey);
|
|
268
|
+
}
|
|
269
|
+
// A group with no rows of its own stays when it is not caught.
|
|
270
|
+
for (const row of rows) {
|
|
271
|
+
const key = answerRow_key(row);
|
|
272
|
+
if (!caught(row) && !hasChildren.has(key) && row.parent === undefined)
|
|
273
|
+
kept.add(key);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
235
276
|
/**
|
|
236
277
|
* Which rows a grep keeps of a listing: a matching row with its parents, a
|
|
237
278
|
* matched group with all its rows; under -v the matching rows (and a
|
|
@@ -244,43 +285,19 @@ export function grepMatcher_build(ask) {
|
|
|
244
285
|
*/
|
|
245
286
|
export function listingRows_grep(rows, matches, invert) {
|
|
246
287
|
const byKey = new Map(rows.map((row) => [answerRow_key(row), row]));
|
|
247
|
-
const ancestors = (row) => {
|
|
248
|
-
const chain = [];
|
|
249
|
-
let parent = row.parent === undefined ? undefined : byKey.get(row.parent);
|
|
250
|
-
while (parent !== undefined && !chain.includes(parent)) {
|
|
251
|
-
chain.push(parent);
|
|
252
|
-
parent = parent.parent === undefined ? undefined : byKey.get(parent.parent);
|
|
253
|
-
}
|
|
254
|
-
return chain;
|
|
255
|
-
};
|
|
256
288
|
const hit = (row) => matches(row.text ?? row.label);
|
|
257
289
|
// A row is caught by its own match or a matched group above it.
|
|
258
|
-
const caught = (row) => hit(row) ||
|
|
290
|
+
const caught = (row) => hit(row) || rowAncestors_collect(row, byKey).some(hit);
|
|
259
291
|
const hasChildren = new Set(rows.flatMap((row) => (row.parent === undefined ? [] : [row.parent])));
|
|
260
292
|
const kept = new Set();
|
|
261
293
|
if (!invert) {
|
|
262
294
|
for (const row of rows) {
|
|
263
|
-
if (
|
|
264
|
-
|
|
265
|
-
kept.add(answerRow_key(row));
|
|
266
|
-
for (const parent of ancestors(row))
|
|
267
|
-
kept.add(answerRow_key(parent));
|
|
295
|
+
if (caught(row))
|
|
296
|
+
rowWithAncestors_keep(kept, row, byKey);
|
|
268
297
|
}
|
|
269
298
|
}
|
|
270
299
|
else {
|
|
271
|
-
|
|
272
|
-
if (caught(row) || hasChildren.has(answerRow_key(row)))
|
|
273
|
-
continue;
|
|
274
|
-
kept.add(answerRow_key(row));
|
|
275
|
-
for (const parent of ancestors(row))
|
|
276
|
-
kept.add(answerRow_key(parent));
|
|
277
|
-
}
|
|
278
|
-
// A group with no rows of its own stays when it is not caught.
|
|
279
|
-
for (const row of rows) {
|
|
280
|
-
const key = answerRow_key(row);
|
|
281
|
-
if (!caught(row) && !hasChildren.has(key) && row.parent === undefined)
|
|
282
|
-
kept.add(key);
|
|
283
|
-
}
|
|
300
|
+
invertedRows_keep(kept, rows, caught, hasChildren, byKey);
|
|
284
301
|
}
|
|
285
302
|
return rows.filter((row) => kept.has(answerRow_key(row)));
|
|
286
303
|
}
|
|
@@ -340,6 +357,113 @@ function listing_grep(listing, ask, line) {
|
|
|
340
357
|
answerOrdinals_attach(filtered, new Map([...keptKeys].map((key) => [key, ordinalOf.get(key) ?? 0])));
|
|
341
358
|
return envelope_ok(rendered, { kind: listing.kind, data: filtered });
|
|
342
359
|
}
|
|
360
|
+
/**
|
|
361
|
+
* Appends only the non-empty matching parts of each line (`grep -o`) to `out`.
|
|
362
|
+
*
|
|
363
|
+
* @param lines - The source lines.
|
|
364
|
+
* @param every - Global RegExp matching the pattern.
|
|
365
|
+
* @param prefix - Line prefix formatter.
|
|
366
|
+
* @param out - Output lines accumulator.
|
|
367
|
+
*/
|
|
368
|
+
function onlyMatching_append(lines, every, prefix, out) {
|
|
369
|
+
lines.forEach((line, at) => {
|
|
370
|
+
for (const match of line.matchAll(every)) {
|
|
371
|
+
if (match[0] !== '')
|
|
372
|
+
out.push(`${prefix(at, ':')}${match[0]}`);
|
|
373
|
+
}
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* Computes which line indices in a source should be shown when including `-B` and `-A` context lines.
|
|
378
|
+
*
|
|
379
|
+
* @param hits - Per-line match flags.
|
|
380
|
+
* @param before - Number of lines of leading context.
|
|
381
|
+
* @param after - Number of lines of trailing context.
|
|
382
|
+
* @returns Boolean mask of lines to print.
|
|
383
|
+
*/
|
|
384
|
+
function contextLines_mark(hits, before, after) {
|
|
385
|
+
const shown = hits.map(() => false);
|
|
386
|
+
hits.forEach((hit, at) => {
|
|
387
|
+
if (!hit)
|
|
388
|
+
return;
|
|
389
|
+
for (let near = Math.max(0, at - before); near <= Math.min(hits.length - 1, at + after); near++) {
|
|
390
|
+
shown[near] = true;
|
|
391
|
+
}
|
|
392
|
+
});
|
|
393
|
+
return shown;
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* Appends matched and context lines for one source to `out`, inserting `--` between non-adjacent groups.
|
|
397
|
+
*
|
|
398
|
+
* @param lines - The source lines.
|
|
399
|
+
* @param hits - Per-line match flags.
|
|
400
|
+
* @param shown - Per-line visibility mask including context.
|
|
401
|
+
* @param grouped - Whether `--` group separators are active.
|
|
402
|
+
* @param printedAny - Whether any line has been printed across prior sources.
|
|
403
|
+
* @param prefix - Line prefix formatter.
|
|
404
|
+
* @param out - Output lines accumulator.
|
|
405
|
+
* @returns True if any line has been printed after processing this source.
|
|
406
|
+
*/
|
|
407
|
+
function contextLines_append(lines, hits, shown, grouped, printedAny, prefix, out) {
|
|
408
|
+
let printed = printedAny;
|
|
409
|
+
let last = -2;
|
|
410
|
+
lines.forEach((line, at) => {
|
|
411
|
+
if (!shown[at])
|
|
412
|
+
return;
|
|
413
|
+
if (grouped && printed && at !== last + 1)
|
|
414
|
+
out.push('--');
|
|
415
|
+
out.push(`${prefix(at, hits[at] === true ? ':' : '-')}${line}`);
|
|
416
|
+
printed = true;
|
|
417
|
+
last = at;
|
|
418
|
+
});
|
|
419
|
+
return printed;
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* Returns the display name for a text filter source (`'(standard input)'` for stdin).
|
|
423
|
+
*
|
|
424
|
+
* @param name - The source name, or `'-'` / `null` for standard input.
|
|
425
|
+
* @returns The display name.
|
|
426
|
+
*/
|
|
427
|
+
function sourceName_display(name) {
|
|
428
|
+
return name === '-' || name === null ? '(standard input)' : name;
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* Formats the filename and line-number prefix for a matched or context line in `grep`.
|
|
432
|
+
*
|
|
433
|
+
* @param name - Display name of the source.
|
|
434
|
+
* @param named - Whether to include the source name prefix.
|
|
435
|
+
* @param lineNumber - Whether `-n` line numbering is active.
|
|
436
|
+
* @param at - Zero-based line index.
|
|
437
|
+
* @param mark - Separator character (`':'` for matches, `'-'` for context).
|
|
438
|
+
* @returns The formatted line prefix.
|
|
439
|
+
*/
|
|
440
|
+
function linePrefix_format(name, named, lineNumber, at, mark) {
|
|
441
|
+
return `${named ? `${name}${mark}` : ''}${lineNumber ? `${at + 1}${mark}` : ''}`;
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* Resolves the before/after context line counts and whether `--` group separators
|
|
445
|
+
* are needed between non-contiguous match windows.
|
|
446
|
+
*
|
|
447
|
+
* @param layout - The grep output layout options.
|
|
448
|
+
* @returns The resolved `before` and `after` counts and `grouped` flag.
|
|
449
|
+
*/
|
|
450
|
+
function contextWindow_resolve(layout) {
|
|
451
|
+
const after = layout.after ?? layout.context ?? 0;
|
|
452
|
+
const before = layout.before ?? layout.context ?? 0;
|
|
453
|
+
const grouped = (after > 0 || before > 0) && !layout.onlyMatching;
|
|
454
|
+
return [before, after, grouped];
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* Formats the match-count output line for `grep -c`.
|
|
458
|
+
*
|
|
459
|
+
* @param name - Display name of the source.
|
|
460
|
+
* @param named - Whether to prefix the count with the source name.
|
|
461
|
+
* @param kept - Number of selected lines in the source.
|
|
462
|
+
* @returns The formatted count line.
|
|
463
|
+
*/
|
|
464
|
+
function countLine_format(name, named, kept) {
|
|
465
|
+
return named ? `${name}:${kept}` : String(kept);
|
|
466
|
+
}
|
|
343
467
|
/**
|
|
344
468
|
* The lines a grep over text writes for its sources, as GNU grep writes
|
|
345
469
|
* them: `name:` before each line when named, `N:` under -n (`-` for a
|
|
@@ -355,19 +479,17 @@ function listing_grep(listing, ask, line) {
|
|
|
355
479
|
*
|
|
356
480
|
* @example
|
|
357
481
|
* ```ts
|
|
358
|
-
* textSources_grep(/b/, ask,
|
|
482
|
+
* textSources_grep(/b/, ask, layout, [{ name: null, text: 'a\nb\n' }], false).text; // 'b\n'
|
|
359
483
|
* ```
|
|
360
484
|
*/
|
|
361
485
|
export function textSources_grep(expression, ask, layout, sources, named) {
|
|
362
|
-
const after = layout
|
|
363
|
-
const before = layout.before ?? layout.context ?? 0;
|
|
364
|
-
const grouped = (after > 0 || before > 0) && !layout.onlyMatching;
|
|
486
|
+
const [before, after, grouped] = contextWindow_resolve(layout);
|
|
365
487
|
const every = new RegExp(expression.source, `${expression.flags.replace('g', '')}g`);
|
|
366
488
|
const out = [];
|
|
367
489
|
let selected = 0;
|
|
368
490
|
let printedAny = false;
|
|
369
491
|
for (const source of sources) {
|
|
370
|
-
const name = source.name
|
|
492
|
+
const name = sourceName_display(source.name);
|
|
371
493
|
const lines = lines_split(source.text);
|
|
372
494
|
const hits = lines.map((line) => expression.test(line) !== ask.invert);
|
|
373
495
|
const kept = hits.filter((hit) => hit).length;
|
|
@@ -378,38 +500,18 @@ export function textSources_grep(expression, ask, layout, sources, named) {
|
|
|
378
500
|
continue;
|
|
379
501
|
}
|
|
380
502
|
if (ask.count) {
|
|
381
|
-
out.push(
|
|
503
|
+
out.push(countLine_format(name, named, kept));
|
|
382
504
|
continue;
|
|
383
505
|
}
|
|
384
|
-
const prefix = (at, mark) =>
|
|
506
|
+
const prefix = (at, mark) => linePrefix_format(name, named, layout.lineNumber, at, mark);
|
|
385
507
|
if (layout.onlyMatching) {
|
|
386
508
|
// Under -v the kept lines are those with no match: no part to show.
|
|
387
|
-
if (ask.invert)
|
|
388
|
-
|
|
389
|
-
lines.forEach((line, at) => {
|
|
390
|
-
for (const match of line.matchAll(every))
|
|
391
|
-
if (match[0] !== '')
|
|
392
|
-
out.push(`${prefix(at, ':')}${match[0]}`);
|
|
393
|
-
});
|
|
509
|
+
if (!ask.invert)
|
|
510
|
+
onlyMatching_append(lines, every, prefix, out);
|
|
394
511
|
continue;
|
|
395
512
|
}
|
|
396
|
-
const shown =
|
|
397
|
-
|
|
398
|
-
if (!hit)
|
|
399
|
-
return;
|
|
400
|
-
for (let near = Math.max(0, at - before); near <= Math.min(lines.length - 1, at + after); near++)
|
|
401
|
-
shown[near] = true;
|
|
402
|
-
});
|
|
403
|
-
let last = -2;
|
|
404
|
-
lines.forEach((line, at) => {
|
|
405
|
-
if (!shown[at])
|
|
406
|
-
return;
|
|
407
|
-
if (grouped && printedAny && at !== last + 1)
|
|
408
|
-
out.push('--');
|
|
409
|
-
out.push(`${prefix(at, hits[at] === true ? ':' : '-')}${line}`);
|
|
410
|
-
printedAny = true;
|
|
411
|
-
last = at;
|
|
412
|
-
});
|
|
513
|
+
const shown = contextLines_mark(hits, before, after);
|
|
514
|
+
printedAny = contextLines_append(lines, hits, shown, grouped, printedAny, prefix, out);
|
|
413
515
|
}
|
|
414
516
|
return { text: lines_join(out), selected };
|
|
415
517
|
}
|
|
@@ -424,13 +526,16 @@ export function textSources_grep(expression, ask, layout, sources, named) {
|
|
|
424
526
|
*/
|
|
425
527
|
async function folder_walk(store, shown, read) {
|
|
426
528
|
const mark = errorStack.checkpoint_mark();
|
|
427
|
-
const listed = await
|
|
529
|
+
const listed = await folderListing_read(store);
|
|
428
530
|
errorStack.checkpoint_drain(mark);
|
|
429
531
|
if (!listed.ok) {
|
|
430
532
|
read.errors += `grep: ${shown || '.'}: cannot list the folder\n`;
|
|
431
533
|
return;
|
|
432
534
|
}
|
|
433
|
-
|
|
535
|
+
// What was read is searched; what was not is said, never passed over.
|
|
536
|
+
if (listed.value.unread !== null)
|
|
537
|
+
read.errors += `grep: ${shown || '.'}: the folder could not be read whole (${error_stripDebugPrefix(listed.value.unread)})\n`;
|
|
538
|
+
for (const item of listed.value.items) {
|
|
434
539
|
const childStore = store === '/' ? `/${item.name}` : `${store}/${item.name}`;
|
|
435
540
|
const childShown = shown === '' ? item.name : `${shown}/${item.name}`;
|
|
436
541
|
if (itemType_isContainer(item.type)) {
|
|
@@ -559,6 +664,51 @@ function listingLayout_refuse(layout) {
|
|
|
559
664
|
exitCode_set(1);
|
|
560
665
|
return envelope_error('', undefined, `grep ${refused.flag}: ${refused.why}\n`);
|
|
561
666
|
}
|
|
667
|
+
/**
|
|
668
|
+
* What a typed grep line asks and how it writes: one reading, for the run and for a reader that must know what the
|
|
669
|
+
* run would hand to the host's grep.
|
|
670
|
+
*
|
|
671
|
+
* @param args - The parsed line.
|
|
672
|
+
* @returns Its ask and layout.
|
|
673
|
+
*/
|
|
674
|
+
function grepLine_read(args) {
|
|
675
|
+
const given = args.options.regexp;
|
|
676
|
+
const pattern = args.operands.pattern;
|
|
677
|
+
return {
|
|
678
|
+
ask: {
|
|
679
|
+
insensitive: args.options.insensitive, invert: args.options.invert, word: args.options.word,
|
|
680
|
+
extended: args.options.extended, fixed: args.options.fixed, count: args.options.count,
|
|
681
|
+
patterns: given.length > 0 ? given : pattern === undefined ? [] : [pattern],
|
|
682
|
+
},
|
|
683
|
+
layout: {
|
|
684
|
+
lineNumber: args.options.lineNumber, filesWithMatches: args.options.filesWithMatches, onlyMatching: args.options.onlyMatching,
|
|
685
|
+
noFilename: args.options.noFilename, withFilename: args.options.withFilename, recursive: args.options.recursive,
|
|
686
|
+
after: args.options.after, before: args.options.before, context: args.options.context, color: args.options.color,
|
|
687
|
+
},
|
|
688
|
+
};
|
|
689
|
+
}
|
|
690
|
+
/**
|
|
691
|
+
* The line a grep segment would hand to the host's grep, when it filters piped text there (`text_grep`): rendered
|
|
692
|
+
* from the segment's own words by the run's own reading and rendering, so it is exactly what the engine would
|
|
693
|
+
* send. Null when the segment would not (files named, recursive, no pattern) or the line does not parse.
|
|
694
|
+
*
|
|
695
|
+
* @param words - The words after `grep`, as the engine tokenizes them.
|
|
696
|
+
* @returns The host line, or null.
|
|
697
|
+
*
|
|
698
|
+
* @example
|
|
699
|
+
* ```ts
|
|
700
|
+
* await grepHostLine_read(shellWords_tokenize('-i t1')); // 'grep -i t1'
|
|
701
|
+
* ```
|
|
702
|
+
*/
|
|
703
|
+
export async function grepHostLine_read(words) {
|
|
704
|
+
const args = await declaredLine_parse(grepCommand, words);
|
|
705
|
+
if (args === null)
|
|
706
|
+
return null;
|
|
707
|
+
const { ask, layout } = grepLine_read(args);
|
|
708
|
+
if (ask.patterns.length === 0 || args.operands.files.length > 0 || layout.recursive)
|
|
709
|
+
return null;
|
|
710
|
+
return grepLine_render(ask, layout);
|
|
711
|
+
}
|
|
562
712
|
/**
|
|
563
713
|
* The typed grep line run: the files named (or walked under -r), else a
|
|
564
714
|
* piped listing, else piped text, else the held listing.
|
|
@@ -567,19 +717,8 @@ function listingLayout_refuse(layout) {
|
|
|
567
717
|
* @returns The envelope.
|
|
568
718
|
*/
|
|
569
719
|
async function grep_run(args) {
|
|
570
|
-
const given = args.options.regexp;
|
|
571
|
-
const pattern = args.operands.pattern;
|
|
572
720
|
const files = args.operands.files;
|
|
573
|
-
const ask =
|
|
574
|
-
insensitive: args.options.insensitive, invert: args.options.invert, word: args.options.word,
|
|
575
|
-
extended: args.options.extended, fixed: args.options.fixed, count: args.options.count,
|
|
576
|
-
patterns: given.length > 0 ? given : pattern === undefined ? [] : [pattern],
|
|
577
|
-
};
|
|
578
|
-
const layout = {
|
|
579
|
-
lineNumber: args.options.lineNumber, filesWithMatches: args.options.filesWithMatches, onlyMatching: args.options.onlyMatching,
|
|
580
|
-
noFilename: args.options.noFilename, withFilename: args.options.withFilename, recursive: args.options.recursive,
|
|
581
|
-
after: args.options.after, before: args.options.before, context: args.options.context, color: args.options.color,
|
|
582
|
-
};
|
|
721
|
+
const { ask, layout } = grepLine_read(args);
|
|
583
722
|
if (ask.patterns.length === 0)
|
|
584
723
|
return envelope_error('', undefined, 'grep: a pattern to keep: grep [-ivwEFc] [-e PATTERN] PATTERN\n');
|
|
585
724
|
const piped = listingIn_take();
|
|
@@ -598,18 +737,4 @@ async function grep_run(args) {
|
|
|
598
737
|
return envelope_error('', undefined, 'grep: nothing to filter: pipe text or a listing in, or list something first (query, ls, gather list)\n');
|
|
599
738
|
return listingLayout_refuse(layout) ?? listing_grep({ kind: held.kind, data: held.data, source: held.source }, ask, grepLine_render(ask, layout));
|
|
600
739
|
}
|
|
601
|
-
/**
|
|
602
|
-
* `grep` over words already split: the declaration's parse and handler.
|
|
603
|
-
*
|
|
604
|
-
* @param args - The words after `grep`.
|
|
605
|
-
* @returns The envelope, or the refusal of a bad line.
|
|
606
|
-
*
|
|
607
|
-
* @example
|
|
608
|
-
* ```ts
|
|
609
|
-
* await builtin_grep(['-i', 't1']);
|
|
610
|
-
* ```
|
|
611
|
-
*/
|
|
612
|
-
export async function builtin_grep(args) {
|
|
613
|
-
return declaredCommand_run(grepCommand, args);
|
|
614
|
-
}
|
|
615
740
|
//# sourceMappingURL=grep.js.map
|