ZeroX-DG / SnippetStore

:tada: A snippet management app for developers :rocket:
https://zerox-dg.github.io/SnippetStoreWeb/
MIT License
868 stars 81 forks source link

Exporting snippets improvement #48

Open bantya opened 5 years ago

bantya commented 5 years ago

Current Behavior

image

Currently the Export JSON button exports the snippet in .json format and not really in the actual snippet filetype. The expoerted snippet json does contain the actual snippet however, it also holds the metadata such as created_date, updated_date, name, tags etc.

Demonstration

This is what an exported snippet looks like:

2019-02-23_18-38-32

I know it is pulled from the snippets.json file:

2019-02-23_18-38-39

Expected Behavior

Upon exporting a snippet, as per https://github.com/ZeroX-DG/SnippetStore/issues/46#issuecomment-466535333, only the snippet content (withput \n, metadata) should be exported as the snippet file name along with snippet file type.

e.g. Here a snippet name is git-issue-draft.md and filetype is markdown, thus the snippet should be exported as git-issue-draft.md filename.

2019-02-23_18-38-46

For multi-file snippets, user should be able to export desired files only.

System Info

image

References

https://github.com/ZeroX-DG/SnippetStore/issues/46#issuecomment-466534795 and https://github.com/ZeroX-DG/SnippetStore/issues/46#issuecomment-466535333

bantya commented 5 years ago

If https://github.com/ZeroX-DG/SnippetStore/issues/46#issuecomment-466534795 is implemented before addressing this (#48) issue, then it will be a hell-lot easy to export the snippets as stated above.

ZeroX-DG commented 5 years ago

I first intended the export feature is for transferring the exported snippet to other computer and import it using the import feature. I didn't make the export snippet content feature because I think people can always click the copy button.

bantya commented 5 years ago

I first intended the export feature is for transferring the exported snippet to other computer and import it using the import feature. I didn't make the export snippet content feature because I think people can always click the copy button.

Copy button is anytime useful. No doubt about that! One may have his/her e.g. utility class/library(s) that they use in almost every project. Copying the snippet content, creating a new file and then pasting into it is somewhat inconvenient.

There is a middle way which can be best of both worlds: Having a setting in (Interface section) which user can toggle to choose between the current export behavior or the newer proposed one may be a great help!

e.g.

    [x] Show snippet update time
    [ ] Show snippet copy count
👉 [x] Export the snippet content only (Export metadata also if unchecked)