File tree Expand file tree Collapse file tree 6 files changed +29
-14
lines changed Expand file tree Collapse file tree 6 files changed +29
-14
lines changed Original file line number Diff line number Diff line change 1
1
.PHONY : lint test
2
2
3
- lint :
4
- shellcheck * .sh
5
-
6
3
test :
7
4
bats * .bats
Original file line number Diff line number Diff line change @@ -6,23 +6,23 @@ setup() {
6
6
7
7
@test " single-line" {
8
8
cat fixtures/single-line.txt | {
9
- run ./cli.sh
9
+ run ./cli.js
10
10
[ " $status " -eq 0 ]
11
11
[ " ${lines[0]} " = " debug-one" ]
12
12
}
13
13
}
14
14
15
15
@test " single-log" {
16
16
cat fixtures/single-log.txt | {
17
- run ./cli.sh
17
+ run ./cli.js
18
18
[ " $status " -eq 0 ]
19
19
[ " ${lines[0]} " = " debug-one" ]
20
20
}
21
21
}
22
22
23
23
@test " multiple-logs-multiple-lines" {
24
24
cat fixtures/multiple-logs-multiple-lines.txt | {
25
- run ./cli.sh
25
+ run ./cli.js
26
26
[ " $status " -eq 0 ]
27
27
[ " ${lines[0]} " = " debug-one" ]
28
28
[ " ${lines[1]} " = " debug-two" ]
@@ -33,7 +33,7 @@ setup() {
33
33
34
34
@test " full" {
35
35
cat fixtures/full.txt | {
36
- run ./cli.sh
36
+ run ./cli.js
37
37
[ " $status " -eq 0 ]
38
38
[ " ${lines[0]} " = " debug-one" ]
39
39
[ " ${lines[1]} " = " debug-two" ]
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env node
2
+
3
+ import { readFileSync } from "fs" ;
4
+ import { filterApexLogs } from "./index.js" ;
5
+
6
+ const input = readFileSync ( 0 , "utf8" ) ;
7
+ console . log ( filterApexLogs ( input ) ) ;
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ const regex =
2
+ / ( .* U S E R _ D E B U G ( \| [ ^ \| ] * ) { 2 } \| ) ( ( .| \n ) + ?) ( ( \n [ \d ] { 2 } : [ \d ] { 2 } : [ \d ] { 2 } \. [ \d ] { 2 } | $ ) ) / g;
3
+
4
+ export function filterApexLogs ( input ) {
5
+ let output = "" ;
6
+ let m ;
7
+ while ( ( m = regex . exec ( input ) ) !== null ) {
8
+ if ( m [ 3 ] ) {
9
+ output += m [ 3 ] + "\n" ;
10
+ }
11
+ }
12
+ return output ;
13
+ }
Original file line number Diff line number Diff line change 2
2
"name" : " apex-log-filter" ,
3
3
"version" : " 0.0.0-development" ,
4
4
"description" : " CLI for filtering USER_DEBUG output from Salesforce Anonymous Apex execution logs" ,
5
- "main" : " " ,
5
+ "main" : " index.js" ,
6
+ "type" : " module" ,
6
7
"scripts" : {
7
- "lint" : " shellcheck *.sh" ,
8
8
"test" : " bats *.bats"
9
9
},
10
10
"bin" : {
11
- "apex-log-filter" : " cli.sh "
11
+ "apex-log-filter" : " cli.js "
12
12
},
13
13
"files" : [
14
- " cli.sh"
14
+ " index.js" ,
15
+ " cli.js"
15
16
],
16
17
"repository" : " amtrack/apex-log-filter" ,
17
18
"author" :
" Matthias Rolke <[email protected] >" ,
You can’t perform that action at this time.
0 commit comments