Skip to content

Commit

Permalink
change output file name (close #5)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vinzent03 committed Dec 27, 2020
1 parent d4381d5 commit f831a21
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
16 changes: 15 additions & 1 deletion main.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { App, getLinkpath, iterateCacheRefs, normalizePath, Plugin, PluginSettingTab, Setting, TFile } from 'obsidian';

interface Settings {
outputFileName: string;
disableWorkingLinks: boolean;
directoriesToIgnore: string[];
filesToIgnore: string[];
Expand All @@ -14,6 +15,7 @@ export default class FindUnlinkedFilesPlugin extends Plugin {
console.log('loading ' + this.manifest.name + " plugin");
let tempData: Settings = await this.loadData();
this.settings = {
outputFileName: tempData?.outputFileName ?? "Find unlinked files plugin output",
disableWorkingLinks: tempData?.disableWorkingLinks ?? false,
directoriesToIgnore: tempData?.directoriesToIgnore ?? [],
filesToIgnore: tempData?.filesToIgnore ?? [],
Expand All @@ -26,7 +28,7 @@ export default class FindUnlinkedFilesPlugin extends Plugin {
id: 'find-unlinked-files',
name: 'Find unlinked files',
callback: async () => {
let outFile = this.manifest.name + " plugin output.md";
let outFile = this.settings.outputFileName + ".md"
let files = this.app.vault.getFiles();
let markdownFiles = this.app.vault.getMarkdownFiles();
let links: String[] = [];
Expand Down Expand Up @@ -144,6 +146,18 @@ class SettingsTab extends PluginSettingTab {
containerEl.empty();
containerEl.createEl("h2", { text: this.plugin.manifest.name })

new Setting(containerEl)
.setName('Output file name')
.setDesc('Set name of output file (without file extension). Make sure no file exists with this name because it will be overwritten! If the name is empty, the default name is set.')
.addText(cb => cb.onChange(value => {
if (value.length == 0) {
this.plugin.settings.outputFileName = "Find unlinked files plugin output";
} else {
this.plugin.settings.outputFileName = value;
}
this.plugin.saveData(this.plugin.settings);
}).setValue(this.plugin.settings.outputFileName));

new Setting(containerEl)
.setName('Disable working links')
.setDesc('Indent lines to disable the link and to clean up the graph view')
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "find-unlinked-files",
"name": "Find unlinked files",
"version": "0.2.4",
"version": "0.2.5",
"description": "Find files that are not linked anywhere and would otherwise be lost in your vault. In other words: files with no backlinks",
"author": "Vinzent",
"authorUrl": "https://github.com/Vinzent03",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "find-unlinked-files",
"version": "0.2.4",
"version": "0.2.5",
"description": "Find files that are not linked anywhere and would otherwise be lost",
"main": "main.js",
"scripts": {
Expand Down

0 comments on commit f831a21

Please sign in to comment.