djyde / snp

VS Code code snippet generator
MIT License
70 stars 5 forks source link

Allow specifying output path #3

Open technodrome opened 3 years ago

technodrome commented 3 years ago

Hi, thanks for an useful utility!

However, it currently has output path hardcoded, which makes it unusable for VS Code Insiders (different path). I know it is possible to generate output file with -p and manually copy it, but why? The whole point of this tool is automation. So let's automate properly.

Please allow a flag -o (currently commented out in your code) to specify where to output the snippets. Or better yet, allow storing such configuration so it is remembered (.toml/.yaml, ...) between runs.

djyde commented 3 years ago

Hi technodrome, thanks for your advice.

The reason I commented out the -o is because i think we can use -p and the > operator to do the same thing but more flexible. Like

snp -p > my.json

is equal to:

snp -o my.json

I am considering adding an extra option (maybe -i) to output to VS Code Insiders path, for example:

snp -u -i

How do you think about it?

technodrome commented 3 years ago

Thanks for finding time to reply, @djyde.

Sure thing, you can automate it with a shell alias but that's an extra step that shouldn't be necessary. If Insiders or Code paths should change, you'd have to redistribute a new version. But if you create a small config file with paths, there's nothing you need to change - only the user.

So I'd personally go for giving the user an ability to customize stuff as they want so you don't have to support hardcoded paths in the long run. You might find such config file useful for other operations in the future as well.