Productivity
Add the following dependency to your Cargo.toml
file:
[dependencies]
untools = "1.0.0" # This is just an example. It is recommended to use the latest version number.
use untools::camel_to_snake;
fn main() {
let camel_case_name = "myVariableName";
let snake_case_name = camel_to_snake(camel_case_name, true);
assert!("MY_VARIABLE_NAME', snake_case_name);
}
use untools::batch_convert;
fn main() {
// Specify the input file, output file, naming convention, and whether to operate in silent mode.
batch_convert("input.txt", "output.txt", true, false);
}
In the example above:
input.txt
" is the path to the input file containing variable names to be converted.output.txt
" is the path to the output file where the converted variable names will be written.SCREAMING_SNAKE_CASE
. Set it to false for camelCase
conversion.$ untools -h
Usage: untools [OPTIONS] <--camel-to-snake|--snake-to-camel|--batch <OUTPUT_FILE>> <INPUT>
Arguments:
<INPUT>
Options:
-c, --is-constant
--camel-to-snake
--snake-to-camel
--batch <OUTPUT_FILE>
-s, --silent
-h, --help Print help
-V, --version Print version
$ untools --camel-to-snake "helloWorld" -c -s
HELLO_WORLD
$ untools --snake-to-camel "hello_world" -c -s
HelloWorld
$ untools --camel-to-snake "hello_world" -s
helloWorld
$ untools --batch "input.txt" "output.txt" -s
Here are the features and improvements we plan to add to the tool in the future. If you have any suggestions or ideas, feel free to share!
SCREAMING_SNAKE_CASE
.plugins
to allow users to use the conversion tool directly in their editors.PascalCase
.If you have any ideas or suggestions regarding the above features, feel free to raise them in the Issues section or directly submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.