Skip to content

Commit

Permalink
Remove the init command
Browse files Browse the repository at this point in the history
  • Loading branch information
mohamedsalem401 committed Dec 6, 2023
1 parent 156f79f commit 48b38c4
Showing 1 changed file with 1 addition and 24 deletions.
25 changes: 1 addition & 24 deletions src/bin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,33 +16,10 @@ async function loadConfig(configFilePath) {
}
}

async function initConfigFile(configFilePath = "mddb.config.js") {
const normalizedPath = path.resolve(configFilePath);
const configFileContent = `export default {\n customFields: []\n};\n`;

try {
await fs.writeFile(normalizedPath, configFileContent);
console.log(`Configuration file created at ${normalizedPath}`);
} catch (error) {
throw new Error(`Error creating configuration file at ${normalizedPath}: ${error.message}`);
}
}

// TODO get these from markdowndb.config.js or something
const dbPath = "markdown.db";
const ignorePatterns = [/Excalidraw/, /\.obsidian/, /DS_Store/];
let command, contentPath, configFilePath;

if (process.argv[2] === 'init') {
[command, contentPath, configFilePath] = process.argv.slice(2);
} else {
[contentPath, configFilePath] = process.argv.slice(2);
}

if (command === 'init') {
await initConfigFile(configFilePath);
process.exit();
}
const [contentPath, configFilePath] = process.argv.slice(2);

if (!contentPath) {
throw new Error("Invalid/Missing path to markdown content folder");
Expand Down

0 comments on commit 48b38c4

Please sign in to comment.