diff --git a/Cargo.lock b/Cargo.lock index 1a752ce..b71ca4e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -384,24 +384,6 @@ dependencies = [ "cc", ] -[[package]] -name = "idkmng" -version = "2.0.0" -dependencies = [ - "chrono", - "clap", - "colored", - "indexmap 2.2.6", - "jq-rs", - "liquid", - "promptly", - "regex", - "serde", - "serde_json", - "shellexpand", - "toml", -] - [[package]] name = "indexmap" version = "1.9.2" @@ -903,6 +885,24 @@ version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" +[[package]] +name = "spark" +version = "2.0.0" +dependencies = [ + "chrono", + "clap", + "colored", + "indexmap 2.2.6", + "jq-rs", + "liquid", + "promptly", + "regex", + "serde", + "serde_json", + "shellexpand", + "toml", +] + [[package]] name = "static_assertions" version = "1.1.0" diff --git a/Cargo.toml b/Cargo.toml index 028b15f..9fc08e7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,17 +1,17 @@ [package] -name = "idkmng" +name = "spark" version = "2.0.0" edition = "2021" -repository = "https://github.com/pwnxpl0it/idkmng" +repository = "https://github.com/pwnxpl0it/spark" authors = ["Mohamed Tarek @pwnxpl0it"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [lib] -name="idkmng" +name="spark" path="src/core/lib.rs" [[bin]] -name="idkmng" +name="spark" path="src/cli/main.rs" [dependencies] diff --git a/README.md b/README.md index cff3b82..b05f159 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# idkmng: A TOML based project initializer. +# spark: A TOML based project initializer. -idkmng is a TOML-based project initializer that helps you quickly set up project directories and files according to predefined templates. It's designed for developers who want to streamline their workflow by automating the creation of consistent project structures. +spark is a TOML-based project initializer that helps you quickly set up project directories and files according to predefined templates. It's designed for developers who want to streamline their workflow by automating the creation of consistent project structures. Template-based, with easy [TOML](https://toml.io/en/) support! @@ -12,44 +12,44 @@ manifest.json Content.js etc.. ``` -Each file has its own structure and syntax. With idkmng, you can effortlessly initialize projects with the required files and configurations using a simple command, regardless of the specific format needed. +Each file has its own structure and syntax. With spark, you can effortlessly initialize projects with the required files and configurations using a simple command, regardless of the specific format needed. For example, to set up a browser extension project, you can run: ```sh -$ idkmng browser_extension +$ spark browser_extension ``` and πŸ’₯ your project files will be ready for your initial commit. Isn’t that amazing? -idkmng is template-based, allowing you to define multiple templates for the same type of project. This means you can customize the initialization process to suit different requirements, such as variations in manifest.json or other project-specific files. +spark is template-based, allowing you to define multiple templates for the same type of project. This means you can customize the initialization process to suit different requirements, such as variations in manifest.json or other project-specific files. ## Installation If you have Rust πŸ¦€ πŸš€ installed on your machine run the following command: ```sh -$ cargo install --git https://www.github.com/pwnxpl0it/idkmng +$ cargo install --git https://www.github.com/pwnxpl0it/spark ``` -Alternatively you can go to [Releases](https://github.com/pwnxpl0it/idkmng/releases) and download the binary +Alternatively you can go to [Releases](https://github.com/pwnxpl0it/spark/releases) and download the binary ```console -$ sudo tar -xzf idkmng-.tar.gz -C /usr/local/bin +$ sudo tar -xzf spark-.tar.gz -C /usr/local/bin ``` Replace with the version number or tag of the release you want to install. -now you should be able to run `idkmng` in your terminal! +now you should be able to run `spark` in your terminal! ## Creating a template πŸ“œ There is a template for creating a template! just run the following command! ```sh -$ idkmng new +$ spark new ``` -enter template name and you should have one, it will go inside `~/.config/idkmng/templates/TEMPLATENAME.toml` +enter template name and you should have one, it will go inside `~/.config/spark/templates/TEMPLATENAME.toml` also you can edit that Template too to create you own template that creates a template πŸŽ‰,
-Default templates path is `~/.config/idkmng/templates`
+Default templates path is `~/.config/spark/templates`
The template structure is like the following: ```toml @@ -108,7 +108,7 @@ content=""" """ ``` -Functions supported by idkmng: +Functions supported by spark: | Function | Description | Example | |--------------- | --------------- | --------------- | @@ -121,7 +121,7 @@ also keep in mind that once a function gets called on a keyword you can use `{{$ Initialize Git during project creation by using: ```console -$ idkmng /path/to/template --git +$ spark /path/to/template --git ``` Or include Git option in the template itself: @@ -204,7 +204,7 @@ This one is just for creating a really BASIC chrome extension. ```toml -[info] # Generated using `idkmng new` btw +[info] # Generated using `spark new` btw name = "browser_extension" description = "A Template for creating a browser extension" author = "Mohamed Tarek @pwnxpl0it" @@ -242,9 +242,9 @@ console.log("Hello world!") ## Loading values from json -You can use json to replace placeholders in your template, idkmng will automatically load values from a json file and replace them automatically +You can use json to replace placeholders in your template, spark will automatically load values from a json file and replace them automatically -idkmng uses JSON Query language to load values from json nodes. +spark uses JSON Query language to load values from json nodes. This is made possible using Rust's [jq-rs crate πŸ¦€](https://github.com/onelson/jq-rs) which has bindings to libjq. @@ -275,7 +275,7 @@ Response Status: {{$.status[0]}} ``` ```sh -$ idkmng template --json test.json +$ spark template --json test.json ``` Output: @@ -295,7 +295,7 @@ Response Status: 200 OK ## Liquid Templating Support πŸ§ͺ -`idkmng` now supports [Liquid](https://shopify.github.io/liquid/) templating alongside its own custom syntax. This allows you to benefit from Liquid's logic (loops, conditionals) while continuing to use `idkmng`'s powerful keyword replacement. +`spark` now supports [Liquid](https://shopify.github.io/liquid/) templating alongside its own custom syntax. This allows you to benefit from Liquid's logic (loops, conditionals) while continuing to use `spark`'s powerful keyword replacement. #### **Example:** ```toml @@ -308,7 +308,7 @@ Example! {{ i }} {{ "{{$file:read}}" | append: ".html" }} """ ``` -- `idkmng` replaces `{{$file:read}}` with user input. +- `spark` replaces `{{$file:read}}` with user input. - Liquid handles loops and string manipulation. #### **Result:** @@ -320,10 +320,10 @@ Example! 4 ff.html Example! 5 ff.html ``` -With this integration, you can create dynamic and flexible templates that combine the strengths of both `idkmng` and Liquid. +With this integration, you can create dynamic and flexible templates that combine the strengths of both `spark` and Liquid. ## Automated Template generation πŸš€ -Also there is one more time saving way! if you have some files in `/foo/bar/` you can just run `idkmng init` and it will create a template for you with directory name `bar.toml` and it will have all your files in it! 🌸 +Also there is one more time saving way! if you have some files in `/foo/bar/` you can just run `spark init` and it will create a template for you with directory name `bar.toml` and it will have all your files in it! 🌸 ```console $ tree @@ -336,7 +336,7 @@ $ tree 4 directories, 2 files -$ idkmng init +$ spark init Creating Template: test123.toml ``` @@ -369,8 +369,8 @@ return M ``` ## Config Keywords βš™οΈ -You can have your own Keywords for idkmng to replace with desired values! -Idkmng finds them stored in $HOME/.config/idkmng/config.toml Or the config path you specified using -c/--config option πŸ¦€ +You can have your own Keywords for spark to replace with desired values! +Idkmng finds them stored in $HOME/.config/spark/config.toml Or the config path you specified using -c/--config option πŸ¦€ ```toml [Keywords] @@ -380,5 +380,5 @@ GITHUB = "https://github.com/pwnxpl0it" #etc ..... ``` -## πŸ‘Ύ Neovim plugin (idkmng.nvim) -I wrote a neovim plugin that makes it a way easier, Check it out [idkmng.nvim](https://www.github.com/pwnxpl0it/idkmng.nvim). +## πŸ‘Ύ Neovim plugin (spark.nvim) +I wrote a neovim plugin that makes it a way easier, Check it out [spark.nvim](https://www.github.com/pwnxpl0it/spark.nvim). diff --git a/src/cli/args.rs b/src/cli/args.rs index 3bd3118..d91a7c9 100644 --- a/src/cli/args.rs +++ b/src/cli/args.rs @@ -4,7 +4,7 @@ pub struct Cli {} impl Cli { pub fn parse() -> clap::ArgMatches { - App::new("idkmng") + App::new("spark") .about("A fast and flexible project initializer using TOML-based templates. Automate project setup, file generation, and reporting workflows with JSON input, dynamic placeholders, and optional Liquid support.") .version("2.0") .author("Mohamed Tarek @pwnxpl0it") @@ -25,7 +25,7 @@ impl Cli { .long("config") .short('c') .help("Config path") - .default_value("~/.config/idkmng/config.toml") + .default_value("~/.config/spark/config.toml") .requires("template"), ) .arg( diff --git a/src/cli/config.rs b/src/cli/config.rs index 685c701..6ddf90f 100644 --- a/src/cli/config.rs +++ b/src/cli/config.rs @@ -1,5 +1,5 @@ -use idkmng::Keywords; -use idkmng::Template; +use spark::Keywords; +use spark::Template; use std::collections::HashMap; use std::fs; use toml::Value; @@ -35,7 +35,7 @@ impl Config { path = 'TEMPLATES_PATH/new.toml' content = ''' [info] -name = "idkmng Template" +name = "Spark Template" description = "A Template for making a template" author = "Mohamed Tarek @pwnxpl0it" diff --git a/src/cli/main.rs b/src/cli/main.rs index 29a13bc..07b5234 100644 --- a/src/cli/main.rs +++ b/src/cli/main.rs @@ -1,6 +1,6 @@ -use crate::config::Config; -use idkmng::Keywords; -use idkmng::Template; +use crate::config::*; +use spark::Keywords; +use spark::Template; use std::fs; mod args; use args::Cli;