notes provider
This commit is contained in:
commit
aa3155ff40
1 changed files with 26 additions and 0 deletions
26
notes/__init__.py
Normal file
26
notes/__init__.py
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
from glob import glob
|
||||||
|
from typing import List
|
||||||
|
|
||||||
|
from porg import Org # typing: ignore
|
||||||
|
|
||||||
|
# TODO move to porg?
|
||||||
|
class PorgAll:
|
||||||
|
def __init__(self, paths: List[str]) -> None:
|
||||||
|
self.paths = paths
|
||||||
|
|
||||||
|
def query_all(self, query):
|
||||||
|
res = []
|
||||||
|
for p in self.paths:
|
||||||
|
ofiles = glob(p + '/**/*.org', recursive=True)
|
||||||
|
for of in ofiles:
|
||||||
|
org = Org.from_file(of)
|
||||||
|
res.extend(query(org))
|
||||||
|
return res
|
||||||
|
|
||||||
|
|
||||||
|
def get_notes():
|
||||||
|
ORG_PATHS = [
|
||||||
|
'***REMOVED***',
|
||||||
|
'***REMOVED***',
|
||||||
|
]
|
||||||
|
return PorgAll(ORG_PATHS)
|
Loading…
Add table
Add a link
Reference in a new issue