Skip to content

Commit 4d71797

Browse files
snip-cli (#4)
* snip-cli * fix path
1 parent 04177b5 commit 4d71797

File tree

7 files changed

+72
-92
lines changed

7 files changed

+72
-92
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: snipr
46+
bin: snip
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: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,25 @@
11
[package]
2-
name = "snipr"
3-
version = "0.1.0"
2+
name = "snip-cli"
3+
version = "0.1.1"
44
edition = "2021"
55
authors = ["Uriah G. <codeitlikemiley@gmail.com>"]
6-
description = "A CLI tool (snipr) for managing Neovim and VSCode snippets"
6+
description = "A CLI tool (snip-cli) for managing Neovim and VSCode snippets"
77
readme = "README.md"
88
license = "MIT"
99
keywords = ["neovim", "snippets", "rust", "cli", "vscode"]
1010
categories = ["command-line-utilities"]
11+
12+
# use in Github workflow `release`
13+
[[bin]]
14+
name = "snip"
15+
path = "src/main.rs"
16+
17+
# Used when Bunding for OSX
18+
[[bin]]
19+
name = "snip-cli"
20+
path = "src/main.rs"
21+
22+
1123
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1224

1325
[dependencies]
@@ -22,15 +34,15 @@ dirs-next = "2.0.0"
2234
dotenv = { version = "0.15.0", features = ["clap"] }
2335

2436
[package.metadata.bundle]
25-
name = "snipr" # The name of your application
26-
identifier = "com.codeitlikemiley.snipr" # The bundle identifier of your application
37+
name = "snip" # The name of your application
38+
identifier = "com.codeitlikemiley.snip" # The bundle identifier of your application
2739
copyright = "Copyright (c) codeitlikemiley 2023. All rights reserved."
2840
category = "Developer Tool"
2941
short_description = "A CLI tool for managing Neovim and VSCode snippets"
3042
long_description = "A CLI tool for managing Neovim and VSCode snippets"
31-
version = "0.1.0" # Version of your application
43+
version = "0.1.1" # Version of your application
3244
osx_url_schemes = [
33-
"com.codeitlikemiley.snipr",
45+
"com.codeitlikemiley.snip",
3446
] # URL schemes your application supports
3547
script = "scripts/postinstall" # Path to your postinstall script
3648

README.md

Lines changed: 33 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,29 @@
1-
# A CLI (snipr) Tool for Managing Neovim and VSCode Snippets
1+
# A CLI (snip-cli) Tool for Managing Neovim and VSCode Snippets
22

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)
3+
[![Rust Build and Test](https://github.com/codeitlikemiley/snip-cli/actions/workflows/test.yml/badge.svg)](https://github.com/codeitlikemiley/snip-cli/actions/workflows/test.yml)
44

5-
[![release](https://github.com/codeitlikemiley/snipr/actions/workflows/release.yml/badge.svg)](https://github.com/codeitlikemiley/snipr/actions/workflows/release.yml)
5+
[![release](https://github.com/codeitlikemiley/snip-cli/actions/workflows/release.yml/badge.svg)](https://github.com/codeitlikemiley/snip-cli/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 [snipr](https://github.com/codeitlikemiley/snipr/releases) on Releases Page
13+
1. You can Download and Install [snip-cli](https://github.com/codeitlikemiley/snip-cli/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
18+
2. Install it using Cargo
1919

2020
```sh
21-
cargo install snipr
22-
```
23-
24-
25-
26-
2. Build it from source
27-
### Clone
28-
```sh
29-
git clone htps://github.com/codeitlikemiley/snipr.git
30-
cd snipr
31-
```
32-
33-
### For MacOS
34-
```sh
35-
./provision.sh
36-
```
37-
38-
### For Linux
39-
```sh
40-
cargo build --release
41-
mv ./target/release/snipr /usr/local/bin/snipr
42-
chmod +x /usr/local/bin/snipr
43-
```
44-
45-
### For Windows
46-
```sh
47-
cargo build --release
48-
49-
# Replace 'YourUsername' with your actual username
50-
Move-Item .\target\release\snipr.exe C:\Users\YourUsername\bin\snipr.exe
51-
52-
# Again, replace 'YourUsername' with your actual username
53-
$env:Path += ";C:\Users\YourUsername\bin"
21+
cargo install snip-cli --bin snip
5422
```
5523

5624
## Managing Multiple Snippets File for Different Languages
5725

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

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

@@ -69,20 +37,20 @@ but you can change it by setting the `SNIP_CONFIG_PATH` environment variable.
6937
1. Help
7038

7139
```sh
72-
snipr
40+
snip
7341
# or
74-
snipr --help
42+
snip --help
7543
```
7644

7745
<details>
7846
<summary>Output</summary>
7947

8048
```sh
81-
snipr
49+
snip
8250
/Users/uriah/.config/nvim/snippets/rust/rust.json
8351
A CLI tool for managing Neovim LuaSnip Rust snippets
8452

85-
Usage: snipr <COMMAND>
53+
Usage: snip <COMMAND>
8654

8755
Commands:
8856
add Adds entry to Snippet Collection file
@@ -104,38 +72,38 @@ Options:
10472
2. Add new snippet
10573
```sh
10674
# help
107-
snipr add --help
75+
snip add --help
10876
# Add Snippet
109-
snipr add --key <key> --value <value> --description <description> -- "<snippet>"
77+
snip add --key <key> --value <value> --description <description> -- "<snippet>"
11078
```
11179
11280
3. Remove snippet
11381
11482
```sh
11583
# help
116-
snipr remove --help
84+
snip remove --help
11785
# Remove Snippet
118-
snipr remove --key <key>
86+
snip remove --key <key>
11987
```
12088
12189
4. List all snippets
12290
12391
```sh
12492
# help
125-
snipr ls --help
93+
snip ls --help
12694
# Usage
127-
snipr ls <LIST_OPTION | (key or prefix)>
95+
snip ls <LIST_OPTION | (key or prefix)>
12896
# List all Keys
129-
snipr ls key
97+
snip ls key
13098
# List all Prefixes
131-
snipr ls prefix
99+
snip ls prefix
132100
```
133101
134102
<details>
135103
<summary>Output</summary>
136104
137105
```sh
138-
snipr ls key
106+
snip ls key
139107
/Users/uriah/.config/nvim/snippets/rust/rust.json
140108
[src/main.rs:468] list_option = Key
141109
impl_iterator
@@ -156,16 +124,16 @@ impl_clone_single_field
156124
157125
```sh
158126
# help
159-
snipr update-key --help
127+
snip update-key --help
160128
# Update Key
161-
snipr update-key --old-key <old-key> --new-key <new-key>
129+
snip update-key --old-key <old-key> --new-key <new-key>
162130
```
163131
164132
<details>
165133
<summary>Output</summary>
166134
167135
```sh
168-
snipr update-key --old-key "Fuzz match String" --new-key "fuzzy-match-string"
136+
snip update-key --old-key "Fuzz match String" --new-key "fuzzy-match-string"
169137
/Users/uriah/.config/nvim/snippets/rust/rust.json
170138
[src/main.rs:499] &old_key = "Fuzz match String"
171139
[src/main.rs:499] &new_key = "fuzzy-match-string"
@@ -177,25 +145,25 @@ snipr update-key --old-key "Fuzz match String" --new-key "fuzzy-match-string"
177145
178146
```sh
179147
# help
180-
snipr edit --help
148+
snip edit --help
181149
# Update snippet Value
182-
snipr edit --key <key> --prefix <prefix> --description <description> -- "<snippet>"
150+
snip edit --key <key> --prefix <prefix> --description <description> -- "<snippet>"
183151
```
184152
185153
7. Search Snippet
186154
187155
```sh
188156
# help
189-
snipr search --help
157+
snip search --help
190158
# Search Snippet
191-
snipr search <ID | (key or prefix)> -- "<search_term>"
159+
snip search <ID | (key or prefix)> -- "<search_term>"
192160
```
193161
194162
<details>
195163
<summary>Output</summary>
196164
197165
```sh
198-
snipr search key -- impl
166+
snip search key -- impl
199167
/Users/uriah/.config/nvim/snippets/rust/rust.json
200168
[src/main.rs:490] id = Some(
201169
Key,
@@ -216,16 +184,16 @@ impl_partialeq_single_field
216184
217185
```sh
218186
# help
219-
snipr show --help
187+
snip show --help
220188
# Show Snippet
221-
snipr show <key_id>
189+
snip show <key_id>
222190
```
223191
224192
<details>
225193
<summary>Output</summary>
226194
227195
```sh
228-
snipr show impl_deref
196+
snip show impl_deref
229197
/Users/uriah/.config/nvim/snippets/rust/rust.json
230198
[src/main.rs:484] &key = "impl_deref"
231199
+-------------+-------------------------------------------------------------+
@@ -258,7 +226,7 @@ Note: This can be used to switch Configuration e.g. you wanna manage Python Snip
258226

259227
```sh
260228
# help
261-
snipr config --help
229+
snip config --help
262230
# Config Snippet
263-
snipr config <path>
231+
snip config <path>
264232
```

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 snipr.pkg
4+
rm snip.pkg
55
cargo zigbuild --release
66
cargo bundle --release
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
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

scripts/postinstall

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ if [ -L "$USER_HOME/.local/bin/snip" ]; then
1717
fi
1818

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

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 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;
3+
use snip_cli::actions::create_directory_and_file::create_directory_and_file;
4+
use snip_cli::actions::edit_snippet_in_file::edit_snippet_in_file;
5+
use snip_cli::actions::list_snippets::list_snippets;
6+
use snip_cli::actions::remove_snippet_from_file::remove_snippet_from_file;
7+
use snip_cli::actions::search_snippets::search_snippets;
8+
use snip_cli::actions::show_snippet::show_snippet;
9+
use snip_cli::actions::update_key_in_file::update_key_in_file;
10+
use snip_cli::actions::write_snippet_to_file::write_snippet_to_file;
11+
use snip_cli::constants::DEFAULT_SNIPPET_PATH;
12+
use snip_cli::helpers::expand_home_dir::expand_home_dir;
13+
use snip_cli::helpers::get_app_config::get_app_config;
14+
use snip_cli::models::cli_model::Cli;
15+
use snip_cli::models::commands_model::Commands;
16+
use snip_cli::models::snip_config_model::SnipConfig;
1717
use std::io::Write;
1818

1919
#[tokio::main]

0 commit comments

Comments
 (0)