Skip to content

Commit ea730cd

Browse files
committed
Link config parms removed and problem in ShowHelp fixed
1 parent 2ca98d7 commit ea730cd

13 files changed

+1216
-100
lines changed

APLSource/Cider/CheckParameters.aplf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
{config}←CheckParameters config;list;bool;list2
1+
{config}←CheckParameters config;list;bool;list2
22
⍝ Check the parameters for being complete and valid
33
p'Checking parameters...'
44
list←' '~⍨¨⊃,/↓¨config.(LINK CIDER).⎕NL 2 9
55
list2←list~GetValidCiderParams
66
bool←(list~GetValidCiderParams)∊GetValidLinkParams
77
('Invalid LINK parameter',((1<+/~bool)/'s'),': ',{0=≢⍵:'' ⋄ ⊃{⍺,',',⍵}/⍵}(~bool)/list2)Assert∧/bool
88
bool←GetValidLinkParams∊list2
9-
('Missing LINK parameter',((1<+/~bool)/'s'),': ',{0=≢⍵:'' ⋄ ⊃{⍺,',',⍵}/⍵}(~bool)/GetValidLinkParams)Assert∧/bool
9+
⍝TODO⍝ ('Missing LINK parameter',((1<+/~bool)/'s'),': ',{0=≢⍵:'' ⋄ ⊃{⍺,',',⍵}/⍵}(~bool)/GetValidLinkParams)Assert∧/bool
1010
list2←list~GetValidLinkParams
1111
bool←(list~GetValidLinkParams)∊GetValidCiderParams
1212
('Invalid Cider parameter',((1<+/~bool)/'s'),': ',{0=≢⍵:'' ⋄ ⊃{⍺,',',⍵}/⍵}(~bool)/list2)Assert∧/bool
Lines changed: 41 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,45 @@
11
options←ExtractLinkOptions config;C;overWrite
2+
⍝ This is slowly going to disappear because Link 4.0 will come with its own set of features
3+
⍝ for setting Link parameters.
24
options←⎕SE.Link.U.DefaultOpts ⎕NS''
35
C←config.LINK
46
overWrite←{0=≢⍵:⍺ ⋄ ⍵}
5-
options.arrays(overWrite)←C.arrays
6-
options.beforeRead(overWrite)←C.beforeRead
7-
options.beforeWrite(overWrite)←C.beforeWrite
8-
options.caseCode(overWrite)←C.caseCode
9-
options.codeExtensions(overWrite)←C.codeExtensions
10-
options.fastLoad(overWrite)←C.fastLoad
11-
options.flatten(overWrite)←C.flatten
12-
options.forceExtensions(overWrite)←C.forceExtensions
13-
options.forceFilenames(overWrite)←C.forceFilenames
14-
options.getFilename(overWrite)←C.getFilename
15-
options.typeExtensions(overWrite)←↑C.typeExtensions
16-
options.watch←C.watch
17-
options.fastLoad←config.LINK.fastLoad
7+
:If 0<C.⎕NC'arrays'
8+
options.arrays(overWrite)←C.arrays
9+
:EndIf
10+
:If 0<C.⎕NC'beforeRead'
11+
options.beforeRead(overWrite)←C.beforeRead
12+
:EndIf
13+
:If 0<C.⎕NC'beforeWrite'
14+
options.beforeWrite(overWrite)←C.beforeWrite
15+
:EndIf
16+
:If 0<C.⎕NC'caseCode'
17+
options.caseCode(overWrite)←C.caseCode
18+
:EndIf
19+
:If 0<C.⎕NC'codeExtensions'
20+
options.codeExtensions(overWrite)←C.codeExtensions
21+
:EndIf
22+
:If 0<C.⎕NC'fastLoad'
23+
options.fastLoad(overWrite)←C.fastLoad
24+
:EndIf
25+
:If 0<C.⎕NC'flatten'
26+
options.flatten(overWrite)←C.flatten
27+
:EndIf
28+
:If 0<C.⎕NC'forceExtensions'
29+
options.forceExtensions(overWrite)←C.forceExtensions
30+
:EndIf
31+
:If 0<C.⎕NC'forceFilenames'
32+
options.forceFilenames(overWrite)←C.forceFilenames
33+
:EndIf
34+
:If 0<C.⎕NC'getFilename'
35+
options.getFilename(overWrite)←C.getFilename
36+
:EndIf
37+
:If 0<C.⎕NC'typeExtensions'
38+
options.typeExtensions(overWrite)←↑C.typeExtensions
39+
:EndIf
40+
:If 0<C.⎕NC'watch'
41+
options.watch←C.watch
42+
:EndIf
43+
:If 0<C.⎕NC'fastLoad'
44+
options.fastLoad←config.LINK.fastLoad
45+
:EndIf
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
cfg←HandleLinkParameters(cfg cfgFilename);linkDefaults;i;list;name;ind;value;flag;json
2+
⍝ With version 0.34.0 Cider removes all Link settings that are defaults anyway from the Cider config file.
3+
⍝ That's what this function is doing. This implies that as a side effect it writes the configuration
4+
⍝ back to file.
5+
linkDefaults←{⍵.{⍵,[1.5]⍎¨⍵}' '~⍨¨↓⍵.⎕NL 2}⎕SE.Link.U.DefaultOpts ⎕NS''
6+
list←' '~⍨¨↓cfg.LINK.⎕NL 2
7+
flag←0
8+
:For i :In ⍳≢list
9+
name←i⊃list
10+
ind←linkDefaults[;1]⍳⊂name
11+
:If ind≤≢linkDefaults
12+
value←cfg.LINK⍎name
13+
:If value≡2⊃linkDefaults[ind;]
14+
:OrIf value≡↓2⊃linkDefaults[ind;]
15+
cfg.LINK.⎕EX name
16+
flag←1
17+
:EndIf
18+
:EndIf
19+
:EndFor
20+
:If flag
21+
json←⎕JSON⍠('Dialect' 'JSON5')('Compact' 0)⊣cfg
22+
(⊂json)⎕NPUT cfgFilename 1
23+
:EndIf
24+
⍝Done

APLSource/Cider/History.apla

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
(
2-
'* 0.34.0 ⋄ 2023-09-09'
2+
'* 0.34.0 ⋄ 2023-09-12'
33
' * `OpenProject` does not report anything but serious stuff and final success to `⎕SE`, but watch out'
44
' for the global config parameter `verbose` and the user command flags `-verbose` and `-batch`'
5-
' * `OpenProject`s `quiet` flag got retied'
6-
' `OpenProject` has now a parameter `verbose` and `batch`; the latter is for tests'
5+
' * `OpenProject`s `quiet` flag was retired'
6+
' * `OpenProject` has now a parameter `verbose` & `batch`; the latter is for tests & build procedures etc'
77
' * `]OpenProject` has now a -verbose flag and a `-batch` flag'
88
' * Cider honours a variable `verbose` in its global configuration file. By default no such file exists,'
99
' meaning that the default is 0. If it does exist it might or might nor carry `verbose`. '
10+
' * Cider deletes Link-specific vars in its config file that equal their defaults anyway'
11+
' * Under rare circumstances `]Cider.Help` produced an error ("File not found") rather than showing the help'
12+
' * `]Cider.Help` did not work on some OS/browser combinations'
1013
'* 0.33.0 ⋄ 2023-09-05'
1114
' * `Cider` is now an ordinary namespace rather than a class script.'
1215
' * `LoadTatinPackages` now reports the URL the packages were loaded from, but only if they were loaded'

APLSource/Cider/OpenProject.aplf

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
config←projectSpace_.⎕NS config
5555
'Already opened?!'Assert~CheckForAlreadyOpened projectSpace_
5656
config←parms PolishProperties config
57+
config←HandleLinkParameters config configFilename
5758
config←CheckParameters config
5859
configFilename HandleSysVars config
5960
source←parms.folder,(0<≢config.CIDER.source)/'/',config.CIDER.source ⍝ For linking we are only interested in the code folder
@@ -76,9 +77,7 @@
7677
:If ∨/'ERRORS ENCOUNTERED:'⍷res
7778
(1 parms.batch)p res
7879
:EndIf
79-
:If 'both'≢linkOptions.watch
80-
(1 parms.batch)p'Link:watch is "',linkOptions.watch,'"' ⍝ Report non-default setting
81-
:EndIf
80+
ReportLinkSettings config
8281
:EndIf
8382
:If 0=parms.noPkgLoad
8483
pkgStatus←parms.folder CheckForTatinPackages config
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
ReportLinkSettings cfg;list
2+
⍝ Report all Link settings (if any) that differ from their default
3+
⍝ `cfg` is a namespace representing a project's Cider config file.
4+
list←' '~⍨¨↓cfg.LINK.⎕NL 2
5+
:If 0<≢list
6+
⎕←⍪cfg∘{'LINK:',⍵,'=',⍕⍺.LINK⍎⍵}¨list
7+
:EndIf

APLSource/Cider/Version.aplf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
r←Version
22
⍝ See als History
3-
r←'0.34.0-beta-1+410'
3+
r←'0.34.0-beta-4+410'

APLSource/Cider_uc.dyalog

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,7 @@
805805
:EndIf
806806
807807

808-
rShowHelp dummy;list;folder;flag;answer;msg
808+
rShowHelp dummy;list;folder;flag;answer;msg;filename;filenames
809809
r''
810810
folder1⎕NPARTS ##.SourceFile
811811
list⎕NINFO('Wildcard' 1)folder,'*'
@@ -822,11 +822,17 @@
822822
:If (answer)1 2(1 2)
823823
:Select answer
824824
:Case 1
825-
{}⎕SE.UCMD'Open file://',folder,1list
825+
filenamefolder,1list
826+
filenameSanitizePath filename
827+
{}⎕SE.UCMD'Open ',filename
826828
:Case 2
827-
{}⎕SE.UCMD'Open file://',folder,2list
829+
filenamefolder,2list
830+
filenameSanitizePath filename
831+
{}⎕SE.UCMD'Open ',filename
828832
:Case 1 2
829-
{}{⎕SE.UCMD'Open file://',}¨folder,¨list
833+
filenamesfolder,¨list
834+
filenamesSanitizePath¨filenames
835+
{}{⎕SE.UCMD'Open ',}¨filenames
830836
:EndSelect
831837
flag1
832838
:Else
@@ -1039,4 +1045,16 @@
10391045
:EndIf
10401046
10411047

1048+
pathSanitizePath path;UNCflag
1049+
Use this to convert any \\ or // to /, and any \ to /
1050+
:If 0<path
1051+
UNCflag'\\'2path
1052+
((path='\')/path)'\'
1053+
path(~'//'path)/path
1054+
:If UNCflag
1055+
path'\\',1path
1056+
:EndIf
1057+
:EndIf
1058+
1059+
10421060
:EndClass

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,3 +186,4 @@ By specifying the `-edit` flag the user might edit the file rather than just vie
186186

187187

188188

189+

apl-package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@
1919
source: "APLSource/Cider/",
2020
tags: "project-management",
2121
userCommandScript: "APLSource/Cider_UC.dyalog",
22-
version: "0.33.0+529",
22+
version: "0.34.0+533",
2323
}

0 commit comments

Comments
 (0)