|
1 | | - {r}←CheckForGit(path config);status;dmx |
2 | | -⍝ Checks whether the project is managed by Git, and if so offers some help |
| 1 | + {r}←CheckForGit(path config parms);status;dmx |
| 2 | +⍝ Checks whether the project is managed by Git, and if so offers some help, unless parms.batch=1 |
3 | 3 | r←⍬ |
4 | | - :If F.Exists(AddSlash path),'.git' |
| 4 | + :If 0=parms.batch |
| 5 | + :AndIf F.Exists(AddSlash path),'.git' |
5 | 6 | :Trap 0 |
6 | 7 | status←G.Status path |
7 | 8 | :Else |
8 | 9 | dmx←⎕DMX |
9 | 10 | :If 127=dmx.EN |
10 | | - p'The project appears to be managed by Git but Git is not installed?!' |
| 11 | + (1 parms.batch)p'The project appears to be managed by Git but Git is not installed?!' |
11 | 12 | :Return |
12 | 13 | :ElseIf 128=dmx.EN |
13 | | - p'The project appears to be managed by Git but user.email and/or user.name are not defined' |
| 14 | + (1 parms.batch)p'The project appears to be managed by Git but user.email and/or user.name are not defined' |
14 | 15 | :Return |
15 | 16 | :ElseIf 0<≢dmx.Message |
16 | | - ⎕←'The Git status of the project could not be determined due to an error:' |
17 | | - ⎕←dmx.Message,'; rc=',⍕dmx.EN |
| 17 | + (1 parms.batch)p'The Git status of the project could not be determined due to an error:' |
| 18 | + (1 parms.batch)pdmx.Message,'; rc=',⍕dmx.EN |
18 | 19 | :Return |
19 | 20 | :Else |
20 | | - ⎕←'The Git status of the project could not be determined due to an error' |
| 21 | + (1 parms.batch)p'The Git status of the project could not be determined due to an error' |
21 | 22 | :Return |
22 | 23 | :EndIf |
23 | 24 | :EndTrap |
24 | 25 | :If ∧/∨/¨'nothing to commit' 'working tree clean'⍷¨⊂∊status |
25 | 26 | :AndIf ~∨/∨/¨'on branch main' 'on branch master'⍷¨⊂⎕C∊status |
26 | | - ⎕←'Git: ',(1⊃status),', ',⊃{⍺,', ',⍵}/1↓status |
27 | | - :Else |
| 27 | + (1 parms.batch)p'Git: ',(1⊃status),', ',⊃{⍺,', ',⍵}/1↓status |
| 28 | + :ElseIf 0=parms.batch |
28 | 29 | status←(↓(,[0.5]'Git status report')⍪'='),status |
29 | 30 | {{}(#.⎕NS'').(⎕ED⍠('ReadOnly' 1)&{'GIT_Status_Report'}GIT_Status_Report←⍵)}⍪status |
30 | 31 | :EndIf |
|
0 commit comments