.../Sources/CutBoxCLICore/CutBoxCLICore.swift
Line | Count | Source |
1 | | import Foundation |
2 | | |
3 | | let version = "v0.2.0" |
4 | | |
5 | | enum SearchMode { |
6 | | case fuzzy, regex, regexi, exact |
7 | | } |
8 | | |
9 | 29 | public func cutBoxCliMain(out: Output, plist: [String: Any]) { |
10 | 29 | let params = CommandParams(out: out, |
11 | 29 | arguments: CommandLine.arguments) |
12 | 29 | |
13 | 29 | if !params.infoFlags { |
14 | 28 | if params.errors.isEmpty { |
15 | 21 | let historyManager = HistoryManager(plist: plist) |
16 | 21 | var historyEntries = historyManager.loadHistoryEntries() |
17 | 21 | |
18 | 21 | historyEntries = historyManager.filterEntries(historyEntries, params: params) |
19 | 21 | historyEntries = historyManager.searchEntries(historyEntries, params: params) |
20 | 21 | |
21 | 21 | let outputManager = OutputManager() |
22 | 21 | outputManager.printEntries(historyEntries, params: params, out: out) |
23 | 28 | } else { |
24 | 7 | params.printErrors() |
25 | 28 | } |
26 | 29 | } |
27 | 29 | } |