-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Add.aplf
36 lines (36 loc) · 987 Bytes
/
Add.aplf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
msg←{opts}Add items
;item;ns;name;roots;this;added;unfound;⎕IO
:If U.debug=2
(1+⊃⎕LC)⎕STOP⊃⎕SI
:EndIf
:Trap DEBUG↓0
⎕IO←1
Default←(⍎'opts'⎕NS ⍬){0=⍺⍺.⎕NC ⍺:⍺⍺⍎⍺,'←⍵'}
'filename'Default''
items←⊆,items
items~¨←' '
roots←{⍵↑⍨⍵⍳'.'}¨items
this←'.',⍨⍕⊃⎕RSI ⎕XSI U.ContainerNs ⍬
items,¨⍨←/∘this¨~roots∊,¨'#' '⎕SE' '⎕DMX'
added←0⍴⊂''
unfound←0⍴⊂''
:For item :In items
:If ×≢⎕NC item
(ns name)←item⊆⍨⌽≤\⌽item≠'.'
ns name Fix''
added,←⊂item
:Else
unfound,←⊂item
:EndIf
:EndFor
msg←0⍴⊂''
:If ×≢added
msg,←⊂'Added:',∊' ',¨added
:EndIf
:If ×≢unfound
msg,←⊂'Not found:',∊' ',¨unfound
:EndIf
msg←↑msg
:Else
U.Resignal 1
:EndTrap