diff --git a/README.md b/README.md index d98e664..11ba1ac 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ This plugin was developed to cover my initial needs and rename a bunch of files and update their reference in code base respectively. So now you can rename a bunch of files from the directory and all imports also will be updated in a code-base -![img.png](documentation/assets/img.png) +![](documentation/assets/Animation.gif) > Under the hood this plugin is using obsidian API for renaming, but we just applying it for many files diff --git a/documentation/assets/Animation.gif b/documentation/assets/Animation.gif new file mode 100644 index 0000000..628a324 Binary files /dev/null and b/documentation/assets/Animation.gif differ diff --git a/main.ts b/main.ts index e912d60..327d350 100644 --- a/main.ts +++ b/main.ts @@ -193,7 +193,7 @@ class BulkRenameSettingsTab extends PluginSettingTab { button.setButtonText('Rename'); button.onClick(async () => { button.setDisabled(true); - renameFilesInObsidian(this.app, this.plugin); + await renameFilesInObsidian(this.app, this.plugin); this.display(); }); }); diff --git a/src/services/file.service.ts b/src/services/file.service.ts index a8fea77..0e452d1 100644 --- a/src/services/file.service.ts +++ b/src/services/file.service.ts @@ -65,7 +65,7 @@ export const replaceFilePath = (plugin: BulkRenamePlugin, file: TFile) => { return `${newPath}.${file.extension}`; }; -export const renameFilesInObsidian = (app: App, plugin: BulkRenamePlugin) => { +export const renameFilesInObsidian = async (app: App, plugin: BulkRenamePlugin) => { const { replacePattern, existingSymbol } = plugin.settings; if (!existingSymbol) { @@ -85,7 +85,7 @@ export const renameFilesInObsidian = (app: App, plugin: BulkRenamePlugin) => { new Notice('renaming has been started'); for (const fileName of plugin.settings.fileNames) { - app.fileManager.renameFile(fileName, replaceFilePath(plugin, fileName)); + await app.fileManager.renameFile(fileName, replaceFilePath(plugin, fileName)); } new Notice('successfully renamed all files'); }; diff --git a/src/services/file.services.test.ts b/src/services/file.services.test.ts index 77575db..fac9ddf 100644 --- a/src/services/file.services.test.ts +++ b/src/services/file.services.test.ts @@ -9,7 +9,6 @@ describe('File Services', () => { it.todo('should display notification after renaming'); }); describe('Validation', () => { - it.todo('should display notification if there an error'); it.todo('should display notification if there an error'); it.todo("should display notification if Existing Symbol doesn't exists"); it.todo(