mirror of
https://github.com/silvanocerza/github-gitless-sync.git
synced 2026-07-22 12:10:28 +00:00
Add settings to handle conflicts and configure sync
This commit is contained in:
parent
b6d217daaa
commit
ec51b658d4
2 changed files with 38 additions and 0 deletions
|
|
@ -7,6 +7,8 @@ export interface GitHubSyncSettings {
|
|||
localContentDir: string;
|
||||
syncStrategy: "manual" | "interval";
|
||||
syncInterval: number;
|
||||
syncOnStartup: boolean;
|
||||
conflictHandling: "ignore" | "ask" | "overwrite";
|
||||
showStatusBarItem: boolean;
|
||||
showDownloadRibbonButton: boolean;
|
||||
showUploadModifiedFilesRibbonButton: boolean;
|
||||
|
|
@ -22,6 +24,8 @@ export const DEFAULT_SETTINGS: GitHubSyncSettings = {
|
|||
localContentDir: "",
|
||||
syncStrategy: "manual",
|
||||
syncInterval: 1,
|
||||
syncOnStartup: false,
|
||||
conflictHandling: "ask",
|
||||
showStatusBarItem: true,
|
||||
showDownloadRibbonButton: true,
|
||||
showUploadModifiedFilesRibbonButton: true,
|
||||
|
|
|
|||
|
|
@ -167,6 +167,40 @@ export default class GitHubSyncSettingsTab extends PluginSettingTab {
|
|||
}),
|
||||
);
|
||||
|
||||
new Setting(containerEl)
|
||||
.setName("Sync on startup")
|
||||
.setDesc("Download up to date files from remote on startup")
|
||||
.addToggle((toggle) => {
|
||||
toggle
|
||||
.setValue(this.plugin.settings.syncOnStartup)
|
||||
.onChange(async (value) => {
|
||||
this.plugin.settings.syncOnStartup = value;
|
||||
await this.plugin.saveSettings();
|
||||
});
|
||||
});
|
||||
|
||||
const conflictHandlingOptions = {
|
||||
ignore: "Ignore remote file",
|
||||
ask: "Ask",
|
||||
overwrite: "Overwrite local file",
|
||||
};
|
||||
new Setting(containerEl)
|
||||
.setName("Conflict handling")
|
||||
.setDesc(
|
||||
`What to do in case remote and local files conflict
|
||||
when downloading from GitHub repository
|
||||
`,
|
||||
)
|
||||
.addDropdown((dropdown) => {
|
||||
dropdown
|
||||
.addOptions(conflictHandlingOptions)
|
||||
.setValue(this.plugin.settings.conflictHandling)
|
||||
.onChange(async (value: keyof typeof conflictHandlingOptions) => {
|
||||
this.plugin.settings.conflictHandling = value;
|
||||
await this.plugin.saveSettings();
|
||||
});
|
||||
});
|
||||
|
||||
containerEl.createEl("h2", { text: "Interface" });
|
||||
|
||||
new Setting(containerEl)
|
||||
|
|
|
|||
Loading…
Reference in a new issue