Skip to content

Conversation

samridh-111
Copy link
Collaborator

commit message
Added "add snippet" feature.
Added its required fields in index.js.
Does work in cli but does not take input yet.

 Added its required fields in index.js. Does work in cli but does not take input yet
Copy link
Member

@Aditya-Chowdhary Aditya-Chowdhary left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good for now for the add snippet one. Now make the similar structure for delete snippet, edit, list, and view snippets.Think about the required details that the user would need to input and create the similar configuration

index.js Outdated
.description('Add your code snippet in the language of your choice')
.option('-l,--lang<language>','specify the programming language')
.option('-d,--desc<description>','describe the code snippet')
.option('-f,--file<path>','Path to the file containting the snippet')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spelling: containing instead of containting

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the options which are compulsory, such as path to file containing snippet, lang, maybe description, consider making them requiredOptions or similar so that if they aren't given the program will throw an error.

@samridh-111 samridh-111 self-assigned this Jun 29, 2025
# server with the `prisma dev` CLI command, when not choosing any non-default ports or settings. The API key, unlike the
# one found in a remote Prisma Postgres URL, does not contain any sensitive information.

DATABASE_URL="postgresql://postgres.wgxbziqzoxkhmhvrqaee:[email protected]:5432/postgres" No newline at end of file

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bruh

Comment on lines +83 to +84
console.error("❌ Provided file does not exist.");
process.exit(1);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider using throw

Comment on lines +114 to +117
console.log(`\n${i + 1}. ${s.name} [${s.lang}]`);
console.log(`📄 ${s.desc}`);
console.log(`📁 ${s.file}`);
console.log(`🏷️ ${s.tags?.join(", ")}`);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use multiline log instead

Comment on lines +133 to +138
console.log(`\n📌 Name: ${snippet.name}`);
console.log(`🖋️ Language: ${snippet.lang}`);
console.log(`📝 Description: ${snippet.desc}`);
console.log(`📁 File: ${snippet.file}`);
console.log(`🏷️ Tags: ${snippet.tags?.join(", ")}`);
console.log(`\n📄 Code:\n${snippet.code}`);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants