UNPKG

loccon

Version:

A simple local context storage and management tool with CLI and web interfaces. Store, search, and organize code snippets, notes, and development contexts with sharded JSON storage.

29 lines 1.25 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createAddCommand = createAddCommand; const commander_1 = require("commander"); const context_1 = require("../../core/context"); const common_1 = require("../../utils/common"); function createAddCommand() { const command = new commander_1.Command('add'); command .description('Add a new context') .argument('<tag>', 'Context tag') .argument('<content>', 'Context content') .option('-c, --categories <categories>', 'Comma-separated categories') .option('-s, --storage-path <path>', 'Custom storage path') .action(async (tag, content, options) => { try { const contextManager = await context_1.ContextManager.create(options.storagePath); const categories = options.categories ? (0, common_1.parseCategories)(options.categories) : []; await contextManager.add(tag, content, categories); console.log(`Added context '${tag}'`); } catch (error) { console.error(`Error: ${error instanceof Error ? error.message : 'Unknown error'}`); process.exit(1); } }); return command; } //# sourceMappingURL=add.js.map