Compare commits
No commits in common. "main" and "1.0.5" have entirely different histories.
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "snp"
|
name = "snp"
|
||||||
authors = ["Dandaedre"]
|
authors = ["Dandaedre"]
|
||||||
version = "1.0.6"
|
version = "1.0.5"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
|
|
||||||
12
TODO.md
12
TODO.md
|
|
@ -6,18 +6,26 @@
|
||||||
[ ] Case sensitivity windows
|
[ ] Case sensitivity windows
|
||||||
[ ] Use Ok for results instead of prints
|
[ ] Use Ok for results instead of prints
|
||||||
[ ] Use priority instead of a cursed match statement
|
[ ] Use priority instead of a cursed match statement
|
||||||
|
[ ] Correct the newline problem (with toml ?)
|
||||||
[ ] Have a method to get name, path and all with a custom error on unwrap
|
[ ] Have a method to get name, path and all with a custom error on unwrap
|
||||||
|
|
||||||
### Currently working on
|
### Currently working on
|
||||||
|
[-] Add some examples with --example
|
||||||
[ ] Have an actual human give feedback on the error name readability
|
[ ] Have an actual human give feedback on the error name readability
|
||||||
|
|
||||||
## Finished
|
## Finished
|
||||||
[*] Add some examples with --example
|
[*] Edit -> edit-all
|
||||||
|
[*] Message on delete
|
||||||
|
[*] Remove last return
|
||||||
|
[*] Remove the prerequiste of name for --list
|
||||||
|
[*] Better message on no erase
|
||||||
|
[*] Comment on no op with replace
|
||||||
|
[*] Add example to the tests on actions, wrapper_functions
|
||||||
|
[*] Double backslash windows
|
||||||
|
|
||||||
## Posponed or rendered useless
|
## Posponed or rendered useless
|
||||||
[x] Chain the methods when possible with result ?
|
[x] Chain the methods when possible with result ?
|
||||||
[ ] Make a lib for dynamic_format and snippets (impl make a trait for have .id() and other future t)
|
[ ] Make a lib for dynamic_format and snippets (impl make a trait for have .id() and other future t)
|
||||||
[ ] Change all uncatchables errors to expect to be more helpful or change them to better errors
|
[ ] Change all uncatchables errors to expect to be more helpful or change them to better errors
|
||||||
[ ] Document non coverage
|
[ ] Document non coverage
|
||||||
[ ] Correct the newline problem (with toml ?)
|
|
||||||
[*] Error: Delete, unclear ?
|
[*] Error: Delete, unclear ?
|
||||||
|
|
@ -12,7 +12,7 @@ mod tokenizer;
|
||||||
mod wrapper_functions;
|
mod wrapper_functions;
|
||||||
|
|
||||||
/// SNP an utility to create and manage Snippets of code
|
/// SNP an utility to create and manage Snippets of code
|
||||||
/// _
|
/// -
|
||||||
/// Use "snp -c -E snippet_name" to create a new Snippet and
|
/// Use "snp -c -E snippet_name" to create a new Snippet and
|
||||||
/// directly start editing it, then use"snp snippet_name" to use it.
|
/// directly start editing it, then use"snp snippet_name" to use it.
|
||||||
/// You can use "{}" or "{0}" in your Snippet to later format it to
|
/// You can use "{}" or "{0}" in your Snippet to later format it to
|
||||||
|
|
|
||||||
|
|
@ -280,16 +280,11 @@ pub fn create_example(_cli: &Cli) -> Result<(), SnippetError> {
|
||||||
let mut path = config_folder()?;
|
let mut path = config_folder()?;
|
||||||
path.push("unique_example.yaml");
|
path.push("unique_example.yaml");
|
||||||
println!(
|
println!(
|
||||||
"The snippet unique_example was created. You can use the following command to launch an editor and begin editing the content of the example:
|
"The snippet unique_example was created. You can use the following command to launch an editor and begin editing it:
|
||||||
$ snp unique_example -e
|
|
||||||
|
|
||||||
Note that only the content of the text is editable in this mode, to edit the whole snippet use:
|
|
||||||
$ snp unique_example -E
|
$ snp unique_example -E
|
||||||
|
|
||||||
Once you are done with the editing, you can try using the snippet with:
|
Once you are done with the editing, you can try using the snippet with:
|
||||||
$ snp unique_example
|
$ snp unique_example
|
||||||
or
|
|
||||||
$ snp unique_example random parameters separated by spaces
|
|
||||||
|
|
||||||
If you wish to delete the snippet, you can use the following command:
|
If you wish to delete the snippet, you can use the following command:
|
||||||
$ snp -d unique_example"
|
$ snp -d unique_example"
|
||||||
|
|
@ -298,13 +293,13 @@ $ snp -d unique_example"
|
||||||
let text = "This is a snippet created as an example.
|
let text = "This is a snippet created as an example.
|
||||||
You can type several lines of code to help you in your daily coding process.
|
You can type several lines of code to help you in your daily coding process.
|
||||||
This snippet manager accepts either {} as a argument placeholder
|
This snippet manager accepts either {} as a argument placeholder
|
||||||
and will fill it with every subsequent argument provided.
|
and will fill it with Argument 1, the first argument.
|
||||||
You can also write {0}, {3}, etc. to use a specific argument
|
You can also use {0} to have the first argument somewhere else.
|
||||||
instead of using them in order.
|
Or {3} to skip to the last argument and finish with {} {} {}
|
||||||
To edit only this text and not the whole code, you can use
|
If you only needed to edit this code part and not the snippet,
|
||||||
`snp unique_example -e` and to edit all parameters
|
you can use instead `snp unique_example -e` (not -E).
|
||||||
(name, default arguments and content) use -E or --edit-all.
|
Please consult the --help for the full list of commands !
|
||||||
Please consult the --help for the full list of commands !";
|
";
|
||||||
let snp = Snippet::new(
|
let snp = Snippet::new(
|
||||||
"unique_example".to_string(),
|
"unique_example".to_string(),
|
||||||
arguments.iter().map(|s| s.to_string()).collect(),
|
arguments.iter().map(|s| s.to_string()).collect(),
|
||||||
|
|
|
||||||
Reference in New Issue