Skip to content

Commit 1f98ba6

Browse files
Merge pull request #2 from codeitlikemiley/snipr
from snip to snipr
2 parents 0aa03a8 + 7d13e3d commit 1f98ba6

File tree

7 files changed

+80
-67
lines changed

7 files changed

+80
-67
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
with:
4444
# (required) Comma-separated list of binary names (non-extension portion of filename) to build and upload.
4545
# Note that glob pattern is not supported yet.
46-
bin: snip
46+
bin: snipr
4747
# (optional) Target triple, default is host triple.
4848
target: ${{ matrix.target }}
4949
# (required) GitHub token for uploading assets to GitHub Releases.

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
[package]
2-
name = "snip"
2+
name = "snipr"
33
version = "0.1.0"
44
edition = "2021"
55
authors = ["Uriah G. <codeitlikemiley@gmail.com>"]
6-
description = "A CLI tool for managing Neovim LuaSnip Rust snippets"
7-
6+
description = "A CLI tool (snipr) for managing Neovim and VSCode snippets"
7+
readme = "README.md"
8+
license = "MIT"
9+
keywords = ["neovim", "snippets", "rust", "cli", "vscode"]
10+
categories = ["command-line-utilities"]
811
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
912

1013
[dependencies]
@@ -19,14 +22,16 @@ dirs-next = "2.0.0"
1922
dotenv = { version = "0.15.0", features = ["clap"] }
2023

2124
[package.metadata.bundle]
22-
name = "snip" # The name of your application
23-
identifier = "com.codeitlikemiley.snip" # The bundle identifier of your application
25+
name = "snipr" # The name of your application
26+
identifier = "com.codeitlikemiley.snipr" # The bundle identifier of your application
2427
copyright = "Copyright (c) codeitlikemiley 2023. All rights reserved."
2528
category = "Developer Tool"
26-
short_description = "A CLI tool for managing Neovim LuaSnip Rust snippets"
27-
long_description = "A CLI tool for managing Neovim LuaSnip Rust snippets"
29+
short_description = "A CLI tool for managing Neovim and VSCode snippets"
30+
long_description = "A CLI tool for managing Neovim and VSCode snippets"
2831
version = "0.1.0" # Version of your application
29-
osx_url_schemes = ["com.codeitlikemiley.snip"] # URL schemes your application supports
32+
osx_url_schemes = [
33+
"com.codeitlikemiley.snipr",
34+
] # URL schemes your application supports
3035
script = "scripts/postinstall" # Path to your postinstall script
3136

3237
[profile.release]

README.md

Lines changed: 45 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,33 @@
1-
# CLI Tool for Managing Neovim and VSCode Snippets
1+
# A CLI (snipr) Tool for Managing Neovim and VSCode Snippets
22

3-
[![Rust Build and Test](https://github.com/codeitlikemiley/snip/actions/workflows/test.yml/badge.svg)](https://github.com/codeitlikemiley/snip/actions/workflows/test.yml)
3+
[![Rust Build and Test](https://github.com/codeitlikemiley/snipr/actions/workflows/test.yml/badge.svg)](https://github.com/codeitlikemiley/snipr/actions/workflows/test.yml)
44

5-
[![release](https://github.com/codeitlikemiley/snip/actions/workflows/release.yml/badge.svg)](https://github.com/codeitlikemiley/snip/actions/workflows/release.yml)
5+
[![release](https://github.com/codeitlikemiley/snipr/actions/workflows/release.yml/badge.svg)](https://github.com/codeitlikemiley/snipr/actions/workflows/release.yml)
66

77
Note: This is an additional tools to be used with my [Neovide Neovim](https://github.com/codeitlikemiley/nvim) rust setup.
88

99
> VSCode Snippet Compatible
1010
1111
## Installation
1212

13-
1. You can Download and Install [snip](https://github.com/codeitlikemiley/snip/releases) on Releases Page
13+
1. You can Download and Install [snipr](https://github.com/codeitlikemiley/snipr/releases) on Releases Page
1414
Note: on MacOS you might need to go to System Preferences > Security & Privacy > General and click Open Anyway to install it
1515

1616
Note: on Windows you might need to Add the command to ENV PATH
1717

18+
or Install it using Cargo
19+
20+
```sh
21+
cargo install snipr
22+
```
23+
24+
25+
1826
2. Build it from source
1927
### Clone
2028
```sh
21-
git clone htps://github.com/codeitlikemiley/snip.git
22-
cd snip
29+
git clone htps://github.com/codeitlikemiley/snipr.git
30+
cd snipr
2331
```
2432

2533
### For MacOS
@@ -30,24 +38,24 @@ cd snip
3038
### For Linux
3139
```sh
3240
cargo build --release
33-
mv ./target/release/snip /usr/local/bin/snip
34-
chmod +x /usr/local/bin/snip
41+
mv ./target/release/snipr /usr/local/bin/snipr
42+
chmod +x /usr/local/bin/snipr
3543
```
3644

3745
### For Windows
3846
```sh
3947
cargo build --release
4048

4149
# Replace 'YourUsername' with your actual username
42-
Move-Item .\target\release\snip.exe C:\Users\YourUsername\bin\snip.exe
50+
Move-Item .\target\release\snipr.exe C:\Users\YourUsername\bin\snipr.exe
4351

4452
# Again, replace 'YourUsername' with your actual username
4553
$env:Path += ";C:\Users\YourUsername\bin"
4654
```
4755

4856
## Managing Multiple Snippets File for Different Languages
4957

50-
You can use the command `snip config <path>` to change the Snippets File on Runtime.
58+
You can use the command `snipr config <path>` to change the Snippets File on Runtime.
5159

5260
Note: This is quite useful when you want to manage different Snippets File for different languages.
5361

@@ -61,20 +69,20 @@ but you can change it by setting the `SNIP_CONFIG_PATH` environment variable.
6169
1. Help
6270

6371
```sh
64-
snip
72+
snipr
6573
# or
66-
snip --help
74+
snipr --help
6775
```
6876

6977
<details>
7078
<summary>Output</summary>
7179

7280
```sh
73-
snip
81+
snipr
7482
/Users/uriah/.config/nvim/snippets/rust/rust.json
7583
A CLI tool for managing Neovim LuaSnip Rust snippets
7684

77-
Usage: snip <COMMAND>
85+
Usage: snipr <COMMAND>
7886

7987
Commands:
8088
add Adds entry to Snippet Collection file
@@ -96,38 +104,38 @@ Options:
96104
2. Add new snippet
97105
```sh
98106
# help
99-
snip add --help
107+
snipr add --help
100108
# Add Snippet
101-
snip add --key <key> --value <value> --description <description> -- "<snippet>"
109+
snipr add --key <key> --value <value> --description <description> -- "<snippet>"
102110
```
103111
104112
3. Remove snippet
105113
106114
```sh
107115
# help
108-
snip remove --help
116+
snipr remove --help
109117
# Remove Snippet
110-
snip remove --key <key>
118+
snipr remove --key <key>
111119
```
112120
113121
4. List all snippets
114122
115123
```sh
116124
# help
117-
snip ls --help
125+
snipr ls --help
118126
# Usage
119-
snip ls <LIST_OPTION | (key or prefix)>
127+
snipr ls <LIST_OPTION | (key or prefix)>
120128
# List all Keys
121-
snip ls key
129+
snipr ls key
122130
# List all Prefixes
123-
snip ls prefix
131+
snipr ls prefix
124132
```
125133
126134
<details>
127135
<summary>Output</summary>
128136
129137
```sh
130-
snip ls key
138+
snipr ls key
131139
/Users/uriah/.config/nvim/snippets/rust/rust.json
132140
[src/main.rs:468] list_option = Key
133141
impl_iterator
@@ -148,16 +156,16 @@ impl_clone_single_field
148156
149157
```sh
150158
# help
151-
snip update-key --help
159+
snipr update-key --help
152160
# Update Key
153-
snip update-key --old-key <old-key> --new-key <new-key>
161+
snipr update-key --old-key <old-key> --new-key <new-key>
154162
```
155163
156164
<details>
157165
<summary>Output</summary>
158166
159167
```sh
160-
snip update-key --old-key "Fuzz match String" --new-key "fuzzy-match-string"
168+
snipr update-key --old-key "Fuzz match String" --new-key "fuzzy-match-string"
161169
/Users/uriah/.config/nvim/snippets/rust/rust.json
162170
[src/main.rs:499] &old_key = "Fuzz match String"
163171
[src/main.rs:499] &new_key = "fuzzy-match-string"
@@ -169,25 +177,25 @@ snip update-key --old-key "Fuzz match String" --new-key "fuzzy-match-string"
169177
170178
```sh
171179
# help
172-
snip edit --help
173-
# Update Snippet Value
174-
snip edit --key <key> --prefix <prefix> --description <description> -- "<snippet>"
180+
snipr edit --help
181+
# Update snippet Value
182+
snipr edit --key <key> --prefix <prefix> --description <description> -- "<snippet>"
175183
```
176184
177185
7. Search Snippet
178186
179187
```sh
180188
# help
181-
snip search --help
189+
snipr search --help
182190
# Search Snippet
183-
snip search <ID | (key or prefix)> -- "<search_term>"
191+
snipr search <ID | (key or prefix)> -- "<search_term>"
184192
```
185193
186194
<details>
187195
<summary>Output</summary>
188196
189197
```sh
190-
snip search key -- impl
198+
snipr search key -- impl
191199
/Users/uriah/.config/nvim/snippets/rust/rust.json
192200
[src/main.rs:490] id = Some(
193201
Key,
@@ -208,16 +216,16 @@ impl_partialeq_single_field
208216
209217
```sh
210218
# help
211-
snip show --help
219+
snipr show --help
212220
# Show Snippet
213-
snip show <key_id>
221+
snipr show <key_id>
214222
```
215223
216224
<details>
217225
<summary>Output</summary>
218226
219227
```sh
220-
snip show impl_deref
228+
snipr show impl_deref
221229
/Users/uriah/.config/nvim/snippets/rust/rust.json
222230
[src/main.rs:484] &key = "impl_deref"
223231
+-------------+-------------------------------------------------------------+
@@ -250,7 +258,7 @@ Note: This can be used to switch Configuration e.g. you wanna manage Python Snip
250258

251259
```sh
252260
# help
253-
snip config --help
261+
snipr config --help
254262
# Config Snippet
255-
snip config <path>
263+
snipr config <path>
256264
```

provision.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
22

33
cargo clean
4-
rm snip.pkg
4+
rm snipr.pkg
55
cargo zigbuild --release
66
cargo bundle --release
7-
pkgbuild --root ./target/release/bundle/osx/snip.app --install-location "/Applications/snip.app" --identifier com.codeitlikemiley.snip --version 0.1.0 --scripts ./scripts snip.pkg
7+
pkgbuild --root ./target/release/bundle/osx/snipr.app --install-location "/Applications/snipr.app" --identifier com.codeitlikemiley.snipr --version 0.1.0 --scripts ./scripts snipr.pkg

scripts/postinstall

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ USER_HOME=$(eval echo ~$REAL_USER)
88

99
# Check if the ~/.local/bin directory exists, if not, create it
1010
if [ ! -d "$USER_HOME/.local/bin" ]; then
11-
mkdir -p "$USER_HOME/.local/bin"
11+
mkdir -p "$USER_HOME/.local/bin"
1212
fi
1313

1414
# delete the old symlink if it exists
1515
if [ -L "$USER_HOME/.local/bin/snip" ]; then
16-
rm "$USER_HOME/.local/bin/snip"
16+
rm "$USER_HOME/.local/bin/snip"
1717
fi
1818

19-
2019
# Create the symlink in ~/.local/bin
21-
ln -s "/Applications/snip.app/Contents/MacOS/snip" "$USER_HOME/.local/bin/snip"
20+
ln -s "/Applications/snipr.app/Contents/MacOS/snipr" "$USER_HOME/.local/bin/snip"
21+

src/main.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
use anyhow::{self, Context, Result};
22
use clap::Parser;
3-
use snip::actions::create_directory_and_file::create_directory_and_file;
4-
use snip::actions::edit_snippet_in_file::edit_snippet_in_file;
5-
use snip::actions::list_snippets::list_snippets;
6-
use snip::actions::remove_snippet_from_file::remove_snippet_from_file;
7-
use snip::actions::search_snippets::search_snippets;
8-
use snip::actions::show_snippet::show_snippet;
9-
use snip::actions::update_key_in_file::update_key_in_file;
10-
use snip::actions::write_snippet_to_file::write_snippet_to_file;
11-
use snip::constants::DEFAULT_SNIPPET_PATH;
12-
use snip::helpers::expand_home_dir::expand_home_dir;
13-
use snip::helpers::get_app_config::get_app_config;
14-
use snip::models::cli_model::Cli;
15-
use snip::models::commands_model::Commands;
16-
use snip::models::snip_config_model::SnipConfig;
3+
use snipr::actions::create_directory_and_file::create_directory_and_file;
4+
use snipr::actions::edit_snippet_in_file::edit_snippet_in_file;
5+
use snipr::actions::list_snippets::list_snippets;
6+
use snipr::actions::remove_snippet_from_file::remove_snippet_from_file;
7+
use snipr::actions::search_snippets::search_snippets;
8+
use snipr::actions::show_snippet::show_snippet;
9+
use snipr::actions::update_key_in_file::update_key_in_file;
10+
use snipr::actions::write_snippet_to_file::write_snippet_to_file;
11+
use snipr::constants::DEFAULT_SNIPPET_PATH;
12+
use snipr::helpers::expand_home_dir::expand_home_dir;
13+
use snipr::helpers::get_app_config::get_app_config;
14+
use snipr::models::cli_model::Cli;
15+
use snipr::models::commands_model::Commands;
16+
use snipr::models::snip_config_model::SnipConfig;
1717
use std::io::Write;
1818

1919
#[tokio::main]

0 commit comments

Comments
 (0)