Add simple glob ignore patterns
This commit is contained in:
parent
bbb2adce63
commit
ceb217cda8
8 changed files with 95 additions and 8 deletions
|
|
@ -11,7 +11,7 @@ import { HistoryView } from "./views/history/history-view";
|
|||
import { StatusBar } from "./views/status-bar/status-bar";
|
||||
import { LogsView } from "./views/logs/logs-view";
|
||||
import { StatusDescription } from "./views/status-description/status-description";
|
||||
import { SyncClient, rateLimit } from "sync-client";
|
||||
import { SyncClient, rateLimit, DEFAULT_SETTINGS } from "sync-client";
|
||||
import { ObsidianFileSystemOperations } from "./obsidian-file-system";
|
||||
import { SyncSettingsTab } from "./views/settings/settings-tab";
|
||||
import { registerConsoleForLogging } from "./utils/register-console-for-logging";
|
||||
|
|
@ -27,6 +27,8 @@ export default class VaultLinkPlugin extends Plugin {
|
|||
>();
|
||||
|
||||
public async onload(): Promise<void> {
|
||||
DEFAULT_SETTINGS.ignorePatterns.push(".obsidian", ".git");
|
||||
|
||||
this.client = await SyncClient.create({
|
||||
fs: new ObsidianFileSystemOperations(
|
||||
this.app.vault,
|
||||
|
|
|
|||
|
|
@ -253,6 +253,29 @@ export class SyncSettingsTab extends PluginSettingTab {
|
|||
)
|
||||
);
|
||||
|
||||
new Setting(containerEl)
|
||||
.setName("Ignore patterns")
|
||||
.setDesc(
|
||||
"Patterns to ignore when syncing. Each line is a separate glob pattern. Patterns are matched against the relative path of the file. For example, to ignore all files in a folder named 'ignore', enter 'ignore/*'. To ignore all files with the extension '.log', enter '*.log'."
|
||||
)
|
||||
.addTextArea((text) =>
|
||||
text
|
||||
.setValue(
|
||||
this.syncClient.getSettings().ignorePatterns.join("\n")
|
||||
)
|
||||
.setPlaceholder("Enter patterns to ignore, one per line")
|
||||
.onChange(async (value) => {
|
||||
const patterns = value
|
||||
.split("\n")
|
||||
.map((pattern) => pattern.trim())
|
||||
.filter((pattern) => pattern.length > 0);
|
||||
return this.syncClient.setSetting(
|
||||
"ignorePatterns",
|
||||
patterns
|
||||
);
|
||||
})
|
||||
);
|
||||
|
||||
new Setting(containerEl)
|
||||
.setName("Sync concurrency")
|
||||
.setDesc(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue