https://github.com/okelleydevelopment/tekton
Blazingly fast code snippet builder
https://github.com/okelleydevelopment/tekton
friendly-snippets nvim rust snippet vim vim-snippets
Last synced: 3 months ago
JSON representation
Blazingly fast code snippet builder
- Host: GitHub
- URL: https://github.com/okelleydevelopment/tekton
- Owner: OkelleyDevelopment
- License: gpl-3.0
- Created: 2022-09-01T23:15:17.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-10-25T02:39:45.000Z (over 1 year ago)
- Last Synced: 2024-04-26T08:47:40.878Z (about 1 year ago)
- Topics: friendly-snippets, nvim, rust, snippet, vim, vim-snippets
- Language: Rust
- Homepage:
- Size: 404 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tekton [![Latest Version]][crates.io] ![Workflow] ![Rustc Version 1.66+]
---
[workflow]: https://github.com/OkelleyDevelopment/tekton/actions/workflows/ci.yml/badge.svg
[latest version]: https://img.shields.io/crates/v/tekton.svg
[crates.io]: https://crates.io/crates/tekton
[rustc version 1.66+]: https://img.shields.io/badge/rustc-1.66+-blue.svgAuthor(s): Nicholas O'Kelley
Date started: 2022-08-28
## Motivation
I needed a tool to speed up the time I spent reviewing snippets on the [`friendly-snippet`](https://github.com/rafamadriz/friendly-snippets) project.
The goals of such a tool are:
- Sort many files **blazingly fast**
- (Ideally) Sort alphabetically **blazingly fast**
- Convert between snipmate and friendly-snippets (json) formats **blazingly** ... **fast**---
## Installation and Usage
### For published versions
- `cargo install tekton`
### For source builds
From the project root:
- `cargo install --path ./`
### Usage
**To convert**:
- `tekton convert `
> Note:
>
> - Conversion supports bidirectional conversion between Snipmate (`*.snippet`) and JSON (`*.json`) snippets
> - Mapping is based on the input file**To sort**:
- General format: `tekton sort [INTERACTIVE] [CRAWL]`
- To sort a single file: `tekton sort `
- To sort a directory: `tekton sort no true`> Note:
>
> - `INTERACTIVE` should be the string `yes` if the user wants to fix any errors during the sort.
>
> - Leaving this off will simply mean an error report is displayed on screen
>
> - `CRAWL` must be present to recursively walk the directories for snippets
> - Any text present will result in a crawl, though `true` looks better.---
## Demos
- Conversion from Snipmate to `JSON`

- Conversion from the `JSON` snippets to Snipmate

- Sorting `friendly-snippets`, **blazingly fast** , with interactive mode off and directory crawling on.

---
## Current Limitations
1. The conversion doesn't process in large batches of files like the sort. This is intentional as conversions between formats should be isolated and limited in scope.
- This can be automated via other scripting means (Rust, Go, Python, etc).
2. Snippet files with an array in the `prefix` field (even if it is just one) will convert all the snippets in the file to then have their snippets inserted into an array too.- **Note**: I am partially working on writing a custom `Serialize` and `Deserialize` implementation to handle clean up the serialization for one element, though that will be tied to a future update.
3. Currently do not sort Snipmate snippets.
- This was outside the scope, but might be something I consider in the future.---
## Acknowledgements
- My impatience for doing this by hand