MCPcopy Create free account
hub / github.com/chhoumann/quickadd / start

Function start

docs/static/scripts/userScriptExample.js:94–293  ·  view source on GitHub ↗
(params, settings)

Source from the content-addressed store, hash-verified

92};
93
94async function start(params, settings) {
95 const { quickAddApi, app, variables, obsidian } = params;
96
97 // ====================
98 // Accessing Settings
99 // ====================
100
101 const projectName = settings["Project Name"];
102 const apiKey = settings["API Key"];
103 const createFolder = settings["Create Folder"];
104 const addTags = settings["Add Tags"];
105 const templateType = settings["Template Type"];
106 const priority = settings["Priority"];
107 const fileNamePattern = settings["File Name Pattern"];
108 const noteTemplate = settings["Note Template"];
109 const maxItems = parseInt(settings["Max Items"]);
110 const repoUrl = settings["Repository URL"];
111
112 console.log("Script started with settings:", {
113 projectName,
114 createFolder,
115 addTags,
116 templateType,
117 priority,
118 maxItems,
119 repoUrl
120 });
121
122 // ====================
123 // Input Validation
124 // ====================
125
126 if (!projectName) {
127 new obsidian.Notice("Please configure a project name in the script settings");
128 throw new Error("Project name is required");
129 }
130
131 if (maxItems < 1 || maxItems > 100) {
132 new obsidian.Notice("Max items must be between 1 and 100");
133 throw new Error("Invalid max items value");
134 }
135
136 // ====================
137 // User Interaction Examples
138 // ====================
139
140 // Get additional input from user
141 const description = await quickAddApi.inputPrompt(
142 "Project Description",
143 "Enter a brief description",
144 "A new QuickAdd project"
145 );
146
147 if (!description) {
148 new obsidian.Notice("No description provided, using default");
149 }
150
151 // Confirm action with user

Callers

nothing calls this directly

Calls 9

getAbstractFileByPathMethod · 0.80
createMethod · 0.80
openFileMethod · 0.80
inputPromptMethod · 0.65
yesNoPromptMethod · 0.65
suggesterMethod · 0.65
checkboxPromptMethod · 0.65
infoDialogMethod · 0.65
formatMethod · 0.45

Tested by

no test coverage detected