FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
atom/src/scan-handler.coffee at master · githubhjs/atom · GitHub
githubhjs
/
atom
Public
forked from
atom/atom
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
atom
/
src
/
scan-handler.coffee
Copy path
More file actions
More file actions
Latest commit
History
History
History
59 lines (47 loc) · 1.59 KB
Breadcrumbs
atom
/
src
/
scan-handler.coffee
Copy path
File metadata and controls
59 lines (47 loc) · 1.59 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
_
=
require
"
underscore-plus
"
path
=
require
"
path
"
async
=
require
"
async
"
{
PathSearcher
,
PathScanner
,
search
}
=
require
'
scandal
'
module
.
exports
=
(
rootPaths
,
regexSource
,
options
)
->
callback
=
@
async
()
rootPath
=
rootPaths[
0
]
PATHS_COUNTER_SEARCHED_CHUNK
=
50
pathsSearched
=
0
searcher
=
new
PathSearcher
()
searcher
.
on
'
file-error
'
, ({code, path, message})
->
emit
(
'
scan:file-error
'
, {code, path, message})
searcher
.
on
'
results-found
'
, (
result
)
->
emit
(
'
scan:result-found
'
, result)
flags
=
"
g
"
flags
+=
"
i
"
if
options
.
ignoreCase
regex
=
new
RegExp
(regexSource, flags)
async
.
each
(
rootPaths,
(
rootPath
,
next
)
->
options2
=
_
.
extend
{}, options,
inclusions
:
processPaths
(rootPath,
options
.
inclusions
)
globalExclusions
:
processPaths
(rootPath,
options
.
globalExclusions
)
scanner
=
new
PathScanner
(rootPath, options2)
scanner
.
on
'
path-found
'
,
->
pathsSearched
++
if
pathsSearched
%
PATHS_COUNTER_SEARCHED_CHUNK
is
0
emit
(
'
scan:paths-searched
'
, pathsSearched)
search
regex, scanner, searcher,
->
emit
(
'
scan:paths-searched
'
, pathsSearched)
next
()
callback
)
processPaths
=
(
rootPath
,
paths
)
->
return
paths
unless
paths
?
.
length
>
0
rootPathBase
=
path
.
basename
(rootPath)
results
=
[]
for
givenPath
in
paths
segments
=
givenPath
.
split
(
path
.
sep
)
firstSegment
=
segments
.
shift
()
results
.
push
(givenPath)
if
firstSegment
is
rootPathBase
if
segments
.
length
is
0
results
.
push
(
path
.
join
(
"
**
"
,
"
*
"
))
else
results
.
push
(
path
.
join
(segments
...
))
results
Back
|
FazBrowse Home
|
New Git URL