Crates.io | ar_cuil_cuit_validator |
lib.rs | ar_cuil_cuit_validator |
version | 0.1.1 |
source | src |
created_at | 2023-10-27 14:12:32.52253 |
updated_at | 2023-10-27 15:25:09.51049 |
description | CLI tool to validate Argentinian CUIL/CUIT number |
homepage | |
repository | https://github.com/santiagoperaza/ar-cuil-cuit-validator |
max_upload_size | |
id | 1016075 |
size | 15,131 |
A command line tool and library to validate Argentinian CUIL/CUIT number.
The format of the CUIL/CUIT identifier consists of 10 digits plus a verification digit that is the result of an arithmetic operation based on the initial digits.
Link to published crate on crates.io
It is required to provide the complete CUIL/CUIT without dashes.
We are using clap to parse the CLI arguments, so running ar_cuil_cuit_validator -h
shows the expected format of the arguments.
ar_cuil_cuit_validator 27280335148
✅ The CUIL/CUIT 27280335148 is valid
ar_cuil_cuit_validator 27280335141
❌ The CUIL/CUIT 27280335141 is not valid
ar_cuil_cuit_validator 27280
Invalid CUIL/CUIT format, it must be 11 digits, received: 27280
You can install the binary in your system with cargo
:
cargo install ar_cuil_cuit_validator
At this point ar_cuil_cuit_validator
will be available as a binary in your system.
If you don't want to install it in your system you can run it with cargo from the project directory.
cargo run 27280335148
✅ The CUIL/CUIT 27280335148 is valid
Run the following Cargo command in your project directory:
cargo add ar_cuil_cuit_validator
Or add the following line to your Cargo.toml:
[dependencies]
ar_cuil_cuit_validator = "*"
Then use it in your code
use ar_cuil_cuit_validator::cuil_cuit;
let valid_cuil_cuit = 27280335148;
let result = is_valid(valid_cuil_cuit).unwrap();
assert_eq!(true, result);
Execute cargo test