Sources/OrgApp/AgendaFiles.swift

61025559a3989ea7536dda296a9e27ddc7909aac
orgstar/Sources/OrgApp/AgendaFiles.swift

16 lines · 782 bytes

 1import Foundation
 2import OrgConfig
 3
 4extension WorkspaceModel {
 5    /// `(org-agenda-files)`: `list` resolved, or when it is empty the org files at the top of
 6    /// each folder (or below it, with `includeSubfolders`), by path, as Emacs lists a
 7    /// directory.
 8    public func agendaFilePaths(list: [String] = OrgPreferences.agendaFiles(), includeSubfolders: Bool = OrgPreferences.agendaSubfolders()) -> [String] {
 9        if !list.isEmpty { return AgendaFiles.resolve(list, base: rootPaths.first) }
10        return files
11            // Dotfiles stay out, as `org-agenda-file-regexp` leaves them out.
12            .filter { $0.kind == .org && !$0.name.hasPrefix(".") && (includeSubfolders || !$0.relativePath.contains("/")) }
13            .map(\.path)
14            .sorted()
15    }
16}
Keyboard shortcuts

Global

⌘K
Command palette & jump
/
Focus search
?
Show this help
g d
Dashboard
g e
Explore repositories
g n
Notifications

Repository & editor

t
Find file in repository
y
Copy immutable SHA permalink
g c
Code tab
g i
Issues tab
g m
Merge requests tab
g b
Builds tab
⌘↵
Submit active form