@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
package/dist/builtins/fs/rm.js
CHANGED
|
@@ -7,13 +7,11 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Key components:
|
|
9
9
|
* - rmCommand: the declaration.
|
|
10
|
-
* - builtin_rm: the declaration run over words already split.
|
|
11
10
|
* - rm_run: the typed core behind both, and the typed API.
|
|
12
11
|
* - rmSummary_format: the line that sums up several removals.
|
|
13
12
|
*
|
|
14
13
|
* Typical usage:
|
|
15
14
|
* ```ts
|
|
16
|
-
* await builtin_rm(['-r', 'scratch']);
|
|
17
15
|
* await rm_run({ recursive: true, force: false, interactive: false, once: false, paths: ['scratch'] });
|
|
18
16
|
* ```
|
|
19
17
|
*
|
|
@@ -22,29 +20,31 @@
|
|
|
22
20
|
*
|
|
23
21
|
* @module
|
|
24
22
|
*/
|
|
25
|
-
import chalk from 'chalk';
|
|
26
23
|
import path from 'path';
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
24
|
+
import { errno_words, rm_render, vfs_fail, vfs_ok, vfsOutcome_isUnconfirmed } from '@fnndsc/fond';
|
|
25
|
+
import { envelope_ok, envelope_error, FS_PROMPT_PURPOSES } from '@fnndsc/menu';
|
|
26
|
+
import chalk from 'chalk';
|
|
27
|
+
import { command_declare } from '../../core/commandDeclaration.js';
|
|
29
28
|
import { listingCache_get, vfsDispatcher_get } from '../../core/filesystem.js';
|
|
30
|
-
import {
|
|
31
|
-
import { errno_words, rm_render, vfs_fail, vfs_ok } from '@fnndsc/fond';
|
|
29
|
+
import { repl_confirm } from '../../core/question.js';
|
|
32
30
|
import { sink_get } from '../../core/sink.js';
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import { declaredCommand_run } from '../../core/commandParse.js';
|
|
31
|
+
import { path_resolve, storePath_resolve } from '../utils.js';
|
|
32
|
+
import { dotOperand_refuse, folderTree_remove, holderKind_isFolder, holders_say } from './entries.js';
|
|
36
33
|
/**
|
|
37
|
-
* Prompts the user for confirmation.
|
|
34
|
+
* Prompts the user for confirmation. The question names what it is for, a
|
|
35
|
+
* removal (`fs.rm`), so a surface draws its destructive control by that,
|
|
36
|
+
* never by its words.
|
|
38
37
|
*
|
|
39
38
|
* @param message - The prompt message.
|
|
39
|
+
* @param target - What is to go: a path, or how many.
|
|
40
40
|
* @returns A Promise resolving to true if user confirms (y/Y), false otherwise.
|
|
41
41
|
*/
|
|
42
|
-
async function prompt_confirm(message) {
|
|
42
|
+
async function prompt_confirm(message, target) {
|
|
43
43
|
// Asked through the SURFACE, never through this process's stdin. Under a
|
|
44
44
|
// daemon that stdin belongs to whoever started the daemon — not to the
|
|
45
45
|
// operator running `rm -i` from a browser three rooms away, who would
|
|
46
46
|
// have waited forever for a question asked of somebody else's terminal.
|
|
47
|
-
return repl_confirm(message);
|
|
47
|
+
return repl_confirm(message, { purpose: FS_PROMPT_PURPOSES.remove, subject: { path: target } });
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
50
|
* Why a question came back with no answer.
|
|
@@ -81,10 +81,11 @@ export function rmSummary_format(successCount, failCount) {
|
|
|
81
81
|
return chalk.red(`Failed to remove ${failCount} item${failCount !== 1 ? 's' : ''}`);
|
|
82
82
|
}
|
|
83
83
|
/**
|
|
84
|
-
* Removes one path. A
|
|
85
|
-
* (a tag
|
|
86
|
-
* or link is removed, a folder only
|
|
87
|
-
*
|
|
84
|
+
* Removes one path. A mount with its own verbs and no proof of what holds a
|
|
85
|
+
* path (a tag) removes or refuses for itself. Elsewhere the owning mount's
|
|
86
|
+
* proof decides (`holder_prove`): a file or link is removed, a folder only
|
|
87
|
+
* with `-r` (with all it holds), more than one holder is refused, a proof
|
|
88
|
+
* that failed is an error, and only a proved absence is fine under `-f`.
|
|
88
89
|
*
|
|
89
90
|
* @param dispatcher - The session's filesystem.
|
|
90
91
|
* @param target - The absolute path.
|
|
@@ -93,16 +94,21 @@ export function rmSummary_format(successCount, failCount) {
|
|
|
93
94
|
* @returns What was removed, and the outcome.
|
|
94
95
|
*/
|
|
95
96
|
async function entry_remove(dispatcher, target, recursive, force) {
|
|
96
|
-
if (dispatcher.
|
|
97
|
+
if (!dispatcher.holderProof_offered(target)) {
|
|
97
98
|
return { type: null, outcome: recursive ? await dispatcher.rmTree(target) : await dispatcher.rm(target) };
|
|
98
99
|
}
|
|
99
|
-
const
|
|
100
|
-
if (
|
|
101
|
-
return { type: null, outcome:
|
|
102
|
-
|
|
100
|
+
const proof = await dispatcher.holder_prove(target, { entry: true });
|
|
101
|
+
if (!proof.ok)
|
|
102
|
+
return { type: null, outcome: proof };
|
|
103
|
+
const held = proof.value;
|
|
104
|
+
if (held.kind === 'absent')
|
|
105
|
+
return { type: null, outcome: force ? vfs_ok(true) : vfs_fail('ENOENT'), absent: true };
|
|
106
|
+
if (held.kind === 'ambiguous')
|
|
107
|
+
return { type: null, outcome: vfs_fail('EPERM', `${holders_say(held.holders)} share ${target}, and neither is removed`) };
|
|
108
|
+
if (holderKind_isFolder(held.holder)) {
|
|
103
109
|
return { type: 'dir', outcome: recursive ? await folderTree_remove(dispatcher, target) : vfs_fail('EISDIR') };
|
|
104
110
|
}
|
|
105
|
-
return { type:
|
|
111
|
+
return { type: held.holder === 'link' ? 'link' : 'file', outcome: await dispatcher.rm(target) };
|
|
106
112
|
}
|
|
107
113
|
/** What an `rm` line may hold. */
|
|
108
114
|
const RM_GRAMMAR = {
|
|
@@ -152,15 +158,6 @@ export const rmCommand = command_declare({
|
|
|
152
158
|
paths: args.operands.paths,
|
|
153
159
|
}),
|
|
154
160
|
});
|
|
155
|
-
/**
|
|
156
|
-
* `rm` over words already split: the declaration's parse and handler.
|
|
157
|
-
*
|
|
158
|
-
* @param args - The words after `rm`.
|
|
159
|
-
* @returns An envelope whose model lists per-target outcomes, or the refusal of a bad line.
|
|
160
|
-
*/
|
|
161
|
-
export async function builtin_rm(args) {
|
|
162
|
-
return declaredCommand_run(rmCommand, args);
|
|
163
|
-
}
|
|
164
161
|
/**
|
|
165
162
|
* Forgets the listings a removal changed: the folder that held the entry and
|
|
166
163
|
* everything cached beneath it, by the session's path and by the store's.
|
|
@@ -178,179 +175,372 @@ function listings_forget(fixed) {
|
|
|
178
175
|
}
|
|
179
176
|
}
|
|
180
177
|
/**
|
|
181
|
-
*
|
|
182
|
-
*
|
|
178
|
+
* Fixes one operand before any question, as the session names it; where
|
|
179
|
+
* the store keeps it is asked only at its turn, after the removals before
|
|
180
|
+
* it (`rm link link/child` must not reach what the link pointed at). An
|
|
181
|
+
* operand ending in `.` or `..` is refused as written, before it is
|
|
182
|
+
* resolved: resolving it would name the folder before it (`link/.` is not
|
|
183
|
+
* `link`).
|
|
183
184
|
*
|
|
184
|
-
*
|
|
185
|
-
*
|
|
186
|
-
* then carries only the model. Otherwise output is buffered into the envelope.
|
|
187
|
-
*
|
|
188
|
-
* @param runArgs - Flags and target paths.
|
|
189
|
-
* @returns An envelope whose model lists per-target outcomes.
|
|
185
|
+
* @param pathArg - The operand as typed.
|
|
186
|
+
* @returns The fixed operand, or the failure to report in its place.
|
|
190
187
|
*/
|
|
191
|
-
|
|
192
|
-
const
|
|
193
|
-
if (
|
|
194
|
-
return
|
|
188
|
+
async function target_fix(pathArg) {
|
|
189
|
+
const dotted = dotOperand_refuse(pathArg);
|
|
190
|
+
if (dotted !== null && !dotted.ok)
|
|
191
|
+
return { failure: new Error(dotted.reason ?? errno_words(dotted.errno)) };
|
|
192
|
+
try {
|
|
193
|
+
return { shown: await path_resolve(pathArg) };
|
|
195
194
|
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
// turn the answer into a removal somewhere else. A path that does not
|
|
199
|
-
// resolve keeps its failure, reported in its place below.
|
|
200
|
-
const fixed = [];
|
|
201
|
-
for (const pathArg of paths) {
|
|
202
|
-
try {
|
|
203
|
-
fixed.push({ shown: await path_resolve(pathArg), target: await storePath_resolve(pathArg, { entry: true }) });
|
|
204
|
-
}
|
|
205
|
-
catch (failure) {
|
|
206
|
-
fixed.push({ failure });
|
|
207
|
-
}
|
|
195
|
+
catch (failure) {
|
|
196
|
+
return { failure };
|
|
208
197
|
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* What an `rm` line has said and done: each line streamed live when a
|
|
201
|
+
* question is asked (so each prompt appears in sequence with its result),
|
|
202
|
+
* buffered into the envelope otherwise; one outcome per operand.
|
|
203
|
+
*/
|
|
204
|
+
class RmReport {
|
|
205
|
+
/** Buffered stdout. */
|
|
206
|
+
rendered = '';
|
|
207
|
+
/** Buffered stderr. */
|
|
208
|
+
renderedErr = '';
|
|
209
|
+
/** One outcome per operand, in order. */
|
|
210
|
+
outcomes = [];
|
|
211
|
+
/** How many were removed. */
|
|
212
|
+
successCount = 0;
|
|
213
|
+
/** How many failed. */
|
|
214
|
+
failCount = 0;
|
|
215
|
+
/** Whether lines stream through the sink (`-i`, `-I`) rather than buffer. */
|
|
216
|
+
live;
|
|
217
|
+
/**
|
|
218
|
+
* Starts an empty report.
|
|
219
|
+
*
|
|
220
|
+
* @param live - True to stream through the sink (`-i`, `-I`).
|
|
221
|
+
*/
|
|
222
|
+
constructor(live) {
|
|
223
|
+
this.live = live;
|
|
234
224
|
}
|
|
235
|
-
const dispatcher = vfsDispatcher_get();
|
|
236
|
-
let successCount = 0;
|
|
237
|
-
let failCount = 0;
|
|
238
|
-
let rendered = '';
|
|
239
|
-
let renderedErr = '';
|
|
240
|
-
const outcomes = [];
|
|
241
225
|
/**
|
|
242
|
-
* Emits one line of stdout output
|
|
243
|
-
* buffered into the envelope otherwise.
|
|
226
|
+
* Emits one line of stdout output.
|
|
244
227
|
*
|
|
245
228
|
* @param line - The line to emit (without trailing newline).
|
|
246
229
|
*/
|
|
247
|
-
|
|
248
|
-
if (
|
|
230
|
+
out_emit(line) {
|
|
231
|
+
if (this.live) {
|
|
249
232
|
sink_get().data_write(`${line}\n`);
|
|
250
233
|
}
|
|
251
234
|
else {
|
|
252
|
-
rendered += `${line}\n`;
|
|
235
|
+
this.rendered += `${line}\n`;
|
|
253
236
|
}
|
|
254
|
-
}
|
|
237
|
+
}
|
|
255
238
|
/**
|
|
256
|
-
* Emits one line of error output
|
|
257
|
-
* buffered into the envelope otherwise.
|
|
239
|
+
* Emits one line of error output.
|
|
258
240
|
*
|
|
259
241
|
* @param line - The line to emit (without trailing newline).
|
|
260
242
|
*/
|
|
261
|
-
|
|
262
|
-
if (
|
|
243
|
+
err_emit(line) {
|
|
244
|
+
if (this.live) {
|
|
263
245
|
sink_get().err_write(`${line}\n`);
|
|
264
246
|
}
|
|
265
247
|
else {
|
|
266
|
-
renderedErr += `${line}\n`;
|
|
248
|
+
this.renderedErr += `${line}\n`;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Notes an operand the operator did not have removed: a no, or a question
|
|
253
|
+
* left unanswered (with why).
|
|
254
|
+
*
|
|
255
|
+
* @param pathArg - The operand as typed.
|
|
256
|
+
* @param unanswered - Why the question had no answer, or null for a no.
|
|
257
|
+
*/
|
|
258
|
+
skip_note(pathArg, unanswered) {
|
|
259
|
+
this.out_emit(chalk.gray(unanswered === null ? `skipped '${pathArg}'` : `skipped '${pathArg}': ${unanswered}`));
|
|
260
|
+
this.outcomes.push({ path: pathArg, removed: false, skipped: true });
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Notes an operand that could not be removed.
|
|
264
|
+
*
|
|
265
|
+
* @param pathArg - The operand as typed.
|
|
266
|
+
* @param reason - Why.
|
|
267
|
+
* @param unconfirmed - True when the removal was accepted and not seen done.
|
|
268
|
+
*/
|
|
269
|
+
failure_note(pathArg, reason, unconfirmed = false) {
|
|
270
|
+
this.err_emit(chalk.red(`rm: cannot remove '${pathArg}': ${reason}`));
|
|
271
|
+
this.outcomes.push(unconfirmed ? { path: pathArg, removed: false, skipped: false, unconfirmed: true } : { path: pathArg, removed: false, skipped: false });
|
|
272
|
+
this.failCount++;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Notes the operands never asked about once the operator walked away:
|
|
276
|
+
* a set of files silently left alone is worse than a set left alone out loud.
|
|
277
|
+
*
|
|
278
|
+
* @param notAsked - The operands after the abandoned one.
|
|
279
|
+
*/
|
|
280
|
+
notAsked_note(notAsked) {
|
|
281
|
+
if (notAsked.length === 0)
|
|
282
|
+
return;
|
|
283
|
+
this.out_emit(chalk.gray(`${notAsked.length} more not asked about, and kept`));
|
|
284
|
+
for (const kept of notAsked) {
|
|
285
|
+
this.outcomes.push({ path: kept, removed: false, skipped: true });
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* The line's envelope, the outcomes as its model.
|
|
290
|
+
*
|
|
291
|
+
* @param several - True when the line named more than one operand, which earns a summary.
|
|
292
|
+
* @returns An error envelope when any removal failed, ok otherwise.
|
|
293
|
+
*/
|
|
294
|
+
envelope_build(several) {
|
|
295
|
+
if (several) {
|
|
296
|
+
const summary = rmSummary_format(this.successCount, this.failCount);
|
|
297
|
+
if (summary) {
|
|
298
|
+
this.out_emit('');
|
|
299
|
+
this.out_emit(summary);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
const model = { kind: 'fs.rm', data: this.outcomes };
|
|
303
|
+
if (this.failCount > 0) {
|
|
304
|
+
const envelope = envelope_error(this.rendered, undefined, this.renderedErr || undefined);
|
|
305
|
+
envelope.model = model;
|
|
306
|
+
return envelope;
|
|
307
|
+
}
|
|
308
|
+
const envelope = envelope_ok(this.rendered, model);
|
|
309
|
+
return envelope;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* The answer when the one question for the whole list (`-I`) was not a yes:
|
|
314
|
+
* nothing removed, everything kept, and why when it went unanswered.
|
|
315
|
+
*
|
|
316
|
+
* @param paths - The operands.
|
|
317
|
+
* @param unanswered - Why the question had no answer, or null for a no.
|
|
318
|
+
* @returns The envelope keeping them all.
|
|
319
|
+
*/
|
|
320
|
+
function rmKept_answer(paths, unanswered) {
|
|
321
|
+
const why = unanswered === null ? '' : `: ${unanswered}`;
|
|
322
|
+
return envelope_ok(`${chalk.gray(`nothing removed (${paths.length} kept)${why}`)}\n`, {
|
|
323
|
+
kind: 'fs.rm',
|
|
324
|
+
data: paths.map((path) => ({ path, removed: false, skipped: true })),
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Records what removing one operand came to: removed, absent under `-f`, or
|
|
329
|
+
* a failure; what is cached of the place is forgotten when it changed.
|
|
330
|
+
*
|
|
331
|
+
* @param report - Where it is said.
|
|
332
|
+
* @param pathArg - The operand as typed.
|
|
333
|
+
* @param resolution - The operand, as shown and in the store.
|
|
334
|
+
* @param removed - What the removal came to.
|
|
335
|
+
* @param several - True when the line named more than one operand.
|
|
336
|
+
*/
|
|
337
|
+
function rmRemoval_record(report, pathArg, resolution, removed, several) {
|
|
338
|
+
// Accepted and not seen done is not removed (it fails below), and what
|
|
339
|
+
// is cached of the place is stale all the same.
|
|
340
|
+
if (vfsOutcome_isUnconfirmed(removed.outcome))
|
|
341
|
+
listings_forget(resolution);
|
|
342
|
+
if (removed.outcome.ok && removed.absent === true) {
|
|
343
|
+
// `-f` on something not there: nothing removed, nothing to say.
|
|
344
|
+
report.outcomes.push({ path: pathArg, removed: false, skipped: false });
|
|
345
|
+
return;
|
|
346
|
+
}
|
|
347
|
+
if (removed.outcome.ok) {
|
|
348
|
+
if (several) {
|
|
349
|
+
report.out_emit(chalk.gray(`removed '${pathArg}'`));
|
|
350
|
+
}
|
|
351
|
+
else {
|
|
352
|
+
report.out_emit(rm_render({ success: true, path: resolution.shown, type: removed.type }));
|
|
267
353
|
}
|
|
268
|
-
|
|
354
|
+
report.outcomes.push({ path: pathArg, removed: true, skipped: false });
|
|
355
|
+
report.successCount++;
|
|
356
|
+
listings_forget(resolution);
|
|
357
|
+
}
|
|
358
|
+
else {
|
|
359
|
+
report.failure_note(pathArg, removed.outcome.reason ?? errno_words(removed.outcome.errno), vfsOutcome_isUnconfirmed(removed.outcome));
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Formats the prompt and target summary for a single `-I` (`once`) confirmation.
|
|
364
|
+
*
|
|
365
|
+
* @param paths - All target paths on the command line.
|
|
366
|
+
* @returns The prompt text and target label.
|
|
367
|
+
*/
|
|
368
|
+
function onceQuestion_build(paths) {
|
|
369
|
+
const target = paths.length === 1 ? paths[0] ?? '' : `${String(paths.length)} items`;
|
|
370
|
+
const prompt = `rm: remove ${paths.length === 1 ? `'${target}'` : target}? (y/n): `;
|
|
371
|
+
return { prompt, target };
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* Extracts a human-readable message from a thrown value.
|
|
375
|
+
*
|
|
376
|
+
* @param error - What was thrown.
|
|
377
|
+
* @returns The error message.
|
|
378
|
+
*/
|
|
379
|
+
function thrownError_say(error) {
|
|
380
|
+
return error instanceof Error ? error.message : String(error);
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* Asks the single `-I` (`once`) confirmation question before any removal.
|
|
384
|
+
*
|
|
385
|
+
* @param paths - All target paths on the command line.
|
|
386
|
+
* @returns The refusal/kept envelope when declined or unanswered, or null when confirmed.
|
|
387
|
+
*/
|
|
388
|
+
async function onceConfirmation_ask(paths) {
|
|
389
|
+
let agreed = false;
|
|
390
|
+
let unanswered = null;
|
|
391
|
+
try {
|
|
392
|
+
const { prompt, target } = onceQuestion_build(paths);
|
|
393
|
+
agreed = await prompt_confirm(prompt, target);
|
|
394
|
+
}
|
|
395
|
+
catch (e) {
|
|
396
|
+
// A question with no answer keeps everything, the same as a no. It
|
|
397
|
+
// says why, so a surface that has quietly lost its voice is not read
|
|
398
|
+
// as an operator who declined.
|
|
399
|
+
unanswered = unanswered_reason(e);
|
|
400
|
+
}
|
|
401
|
+
return agreed ? null : rmKept_answer(paths, unanswered);
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* Extracts the resolved logical path from a fixed operand, throwing its
|
|
405
|
+
* resolution failure when it could not be fixed.
|
|
406
|
+
*
|
|
407
|
+
* @param operand - The fixed operand entry.
|
|
408
|
+
* @returns The resolved logical path.
|
|
409
|
+
* @throws {unknown} When the operand could not be resolved.
|
|
410
|
+
*/
|
|
411
|
+
function operandShown_take(operand) {
|
|
412
|
+
if ('failure' in operand)
|
|
413
|
+
throw operand.failure;
|
|
414
|
+
return operand.shown;
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* Resolves and removes one confirmed operand, recording the outcome on `report`.
|
|
418
|
+
*
|
|
419
|
+
* @param dispatcher - The VFS dispatcher.
|
|
420
|
+
* @param report - The accumulating removal report.
|
|
421
|
+
* @param pathArg - The path as typed.
|
|
422
|
+
* @param shown - The resolved logical path.
|
|
423
|
+
* @param runArgs - Flags and target paths.
|
|
424
|
+
*/
|
|
425
|
+
async function confirmedOperand_remove(dispatcher, report, pathArg, shown, runArgs) {
|
|
426
|
+
const resolution = { shown, target: await storePath_resolve(shown, { entry: true }) };
|
|
427
|
+
const removed = await entry_remove(dispatcher, resolution.target, runArgs.recursive, runArgs.force);
|
|
428
|
+
rmRemoval_record(report, pathArg, resolution, removed, runArgs.paths.length > 1);
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* Creates the `RmReport` for a removal run, streaming when `-i` or `-I` is active.
|
|
432
|
+
*
|
|
433
|
+
* @param interactive - Whether `-i` is active.
|
|
434
|
+
* @param once - Whether `-I` is active.
|
|
435
|
+
* @returns The initialized report.
|
|
436
|
+
*/
|
|
437
|
+
function rmReport_create(interactive, once) {
|
|
438
|
+
return new RmReport(interactive || once);
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* Finalizes the removal report, noting any paths skipped after an abandoned `-i` prompt.
|
|
442
|
+
*
|
|
443
|
+
* @param report - The removal report.
|
|
444
|
+
* @param paths - All target paths on the command line.
|
|
445
|
+
* @param abandonedAt - Index where the operator abandoned `-i`, or null.
|
|
446
|
+
* @returns The completed command envelope.
|
|
447
|
+
*/
|
|
448
|
+
function rmReport_finish(report, paths, abandonedAt) {
|
|
449
|
+
if (abandonedAt !== null)
|
|
450
|
+
report.notAsked_note(paths.slice(abandonedAt + 1));
|
|
451
|
+
return report.envelope_build(paths.length > 1);
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* Prompts for interactive removal of a single operand, keeping the `try/catch`
|
|
455
|
+
* around `prompt_confirm` only so any sink error during `skip_note` propagates
|
|
456
|
+
* to the per-operand error handler.
|
|
457
|
+
*
|
|
458
|
+
* @param report - The removal report.
|
|
459
|
+
* @param pathArg - The operand as typed.
|
|
460
|
+
* @returns `'confirmed'`, `'skipped'`, or `'abandoned'`.
|
|
461
|
+
*/
|
|
462
|
+
async function interactiveOperand_confirm(report, pathArg) {
|
|
463
|
+
let confirmed = false;
|
|
464
|
+
try {
|
|
465
|
+
confirmed = await prompt_confirm(`rm: remove '${pathArg}'? (y/n): `, pathArg);
|
|
466
|
+
}
|
|
467
|
+
catch (e) {
|
|
468
|
+
// Abandoning is an answer, and it answers for the rest of the
|
|
469
|
+
// walk: an operator who backed out of this question is not
|
|
470
|
+
// waiting to be asked the next nineteen.
|
|
471
|
+
report.skip_note(pathArg, unanswered_reason(e));
|
|
472
|
+
return 'abandoned';
|
|
473
|
+
}
|
|
474
|
+
if (!confirmed) {
|
|
475
|
+
report.skip_note(pathArg, null);
|
|
476
|
+
return 'skipped';
|
|
477
|
+
}
|
|
478
|
+
return 'confirmed';
|
|
479
|
+
}
|
|
480
|
+
/**
|
|
481
|
+
* Fixes every operand as an absolute logical path before any interactive question is asked.
|
|
482
|
+
*
|
|
483
|
+
* @param paths - All target paths on the command line.
|
|
484
|
+
* @returns Fixed operands or their resolution failures in order.
|
|
485
|
+
*/
|
|
486
|
+
async function operands_fix(paths) {
|
|
487
|
+
const fixed = [];
|
|
488
|
+
for (const pathArg of paths)
|
|
489
|
+
fixed.push(await target_fix(pathArg));
|
|
490
|
+
return fixed;
|
|
491
|
+
}
|
|
492
|
+
/**
|
|
493
|
+
* Removes files or directories: the shared typed core behind the parsed
|
|
494
|
+
* builtin and the typed API.
|
|
495
|
+
*
|
|
496
|
+
* In interactive mode (-i, -I) output is streamed live through the sink so
|
|
497
|
+
* each confirmation prompt appears in sequence with its result; the envelope
|
|
498
|
+
* then carries only the model. Otherwise output is buffered into the envelope.
|
|
499
|
+
*
|
|
500
|
+
* @param runArgs - Flags and target paths.
|
|
501
|
+
* @returns An envelope whose model lists per-target outcomes.
|
|
502
|
+
*/
|
|
503
|
+
export async function rm_run(runArgs) {
|
|
504
|
+
const { interactive, once, paths } = runArgs;
|
|
505
|
+
if (paths.length === 0) {
|
|
506
|
+
return envelope_error('', undefined, `${chalk.red('Usage: rm [-rfiI] <path> [path...]')}\n`);
|
|
507
|
+
}
|
|
508
|
+
// Every operand is fixed, as an absolute path, before any question is
|
|
509
|
+
// asked: while a question is open the session runs other commands, and a
|
|
510
|
+
// `cd` among them must not turn the answer into a removal somewhere else.
|
|
511
|
+
// Where the store keeps it is asked at its turn, after the removals
|
|
512
|
+
// before it. A path that does not resolve keeps its failure, said below.
|
|
513
|
+
const fixed = await operands_fix(paths);
|
|
514
|
+
// One question for the whole list, asked before anything is removed and
|
|
515
|
+
// naming what will go. A refusal removes nothing at all — there is no
|
|
516
|
+
// half of a set.
|
|
517
|
+
const kept = once ? await onceConfirmation_ask(paths) : null;
|
|
518
|
+
if (kept !== null)
|
|
519
|
+
return kept;
|
|
520
|
+
const dispatcher = vfsDispatcher_get();
|
|
521
|
+
const report = rmReport_create(interactive, once);
|
|
269
522
|
// Where the operator walked away, when they did: everything after it was
|
|
270
|
-
// never put to them
|
|
271
|
-
// a set left alone out loud.
|
|
523
|
+
// never put to them.
|
|
272
524
|
let abandonedAt = null;
|
|
273
525
|
for (let index = 0; index < paths.length; index++) {
|
|
274
526
|
const pathArg = paths[index];
|
|
275
527
|
try {
|
|
276
|
-
const
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
if (
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
confirmed = await prompt_confirm(`rm: remove '${pathArg}'? (y/n): `);
|
|
284
|
-
}
|
|
285
|
-
catch (e) {
|
|
286
|
-
// Abandoning is an answer, and it answers for the rest of the
|
|
287
|
-
// walk: an operator who backed out of this question is not
|
|
288
|
-
// waiting to be asked the next nineteen.
|
|
289
|
-
out_emit(chalk.gray(`skipped '${pathArg}': ${unanswered_reason(e)}`));
|
|
290
|
-
outcomes.push({ path: pathArg, removed: false, skipped: true });
|
|
291
|
-
abandonedAt = index;
|
|
292
|
-
break;
|
|
293
|
-
}
|
|
294
|
-
if (!confirmed) {
|
|
295
|
-
out_emit(chalk.gray(`skipped '${pathArg}'`));
|
|
296
|
-
outcomes.push({ path: pathArg, removed: false, skipped: true });
|
|
297
|
-
continue;
|
|
298
|
-
}
|
|
528
|
+
const shown = operandShown_take(fixed[index]);
|
|
529
|
+
const verdict = interactive
|
|
530
|
+
? await interactiveOperand_confirm(report, pathArg)
|
|
531
|
+
: 'confirmed';
|
|
532
|
+
if (verdict === 'abandoned') {
|
|
533
|
+
abandonedAt = index;
|
|
534
|
+
break;
|
|
299
535
|
}
|
|
300
|
-
|
|
301
|
-
if (removed.outcome.ok && removed.type === null && !dispatcher.path_isVirtual(target)) {
|
|
302
|
-
// `-f` on something not there: nothing removed, nothing to say.
|
|
303
|
-
outcomes.push({ path: pathArg, removed: false, skipped: false });
|
|
536
|
+
if (verdict === 'skipped')
|
|
304
537
|
continue;
|
|
305
|
-
|
|
306
|
-
if (removed.outcome.ok) {
|
|
307
|
-
if (paths.length > 1) {
|
|
308
|
-
out_emit(chalk.gray(`removed '${pathArg}'`));
|
|
309
|
-
}
|
|
310
|
-
else {
|
|
311
|
-
out_emit(rm_render({ success: true, path: resolution.shown, type: removed.type }));
|
|
312
|
-
}
|
|
313
|
-
outcomes.push({ path: pathArg, removed: true, skipped: false });
|
|
314
|
-
successCount++;
|
|
315
|
-
listings_forget(resolution);
|
|
316
|
-
}
|
|
317
|
-
else {
|
|
318
|
-
const reason = removed.outcome.reason ?? errno_words(removed.outcome.errno);
|
|
319
|
-
err_emit(chalk.red(`rm: cannot remove '${pathArg}': ${reason}`));
|
|
320
|
-
outcomes.push({ path: pathArg, removed: false, skipped: false });
|
|
321
|
-
failCount++;
|
|
322
|
-
}
|
|
538
|
+
await confirmedOperand_remove(dispatcher, report, pathArg, shown, runArgs);
|
|
323
539
|
}
|
|
324
540
|
catch (e) {
|
|
325
|
-
|
|
326
|
-
err_emit(chalk.red(`rm: cannot remove '${pathArg}': ${msg}`));
|
|
327
|
-
outcomes.push({ path: pathArg, removed: false, skipped: false });
|
|
328
|
-
failCount++;
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
if (abandonedAt !== null) {
|
|
332
|
-
const notAsked = paths.slice(abandonedAt + 1);
|
|
333
|
-
if (notAsked.length > 0) {
|
|
334
|
-
out_emit(chalk.gray(`${notAsked.length} more not asked about, and kept`));
|
|
335
|
-
for (const kept of notAsked) {
|
|
336
|
-
outcomes.push({ path: kept, removed: false, skipped: true });
|
|
337
|
-
}
|
|
541
|
+
report.failure_note(pathArg, thrownError_say(e));
|
|
338
542
|
}
|
|
339
543
|
}
|
|
340
|
-
|
|
341
|
-
const summary = rmSummary_format(successCount, failCount);
|
|
342
|
-
if (summary) {
|
|
343
|
-
out_emit('');
|
|
344
|
-
out_emit(summary);
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
const model = { kind: 'fs.rm', data: outcomes };
|
|
348
|
-
if (failCount > 0) {
|
|
349
|
-
const envelope = envelope_error(rendered, undefined, renderedErr || undefined);
|
|
350
|
-
envelope.model = model;
|
|
351
|
-
return envelope;
|
|
352
|
-
}
|
|
353
|
-
const envelope = envelope_ok(rendered, model);
|
|
354
|
-
return envelope;
|
|
544
|
+
return rmReport_finish(report, paths, abandonedAt);
|
|
355
545
|
}
|
|
356
546
|
//# sourceMappingURL=rm.js.map
|