Skip to content

Commit be97c50

Browse files
committed
updating error reporting for successful case
1 parent ff36b3f commit be97c50

11 files changed

+25
-19
lines changed

Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "cemtexer"
3-
version = "0.1.1"
3+
version = "0.1.2"
44
edition = "2021"
55
authors = ["Geoffrey Borough <[email protected]>"]
66
readme = "README.md"

src/cemtex.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ impl CemtexInner {
107107
}
108108

109109
if error_count.eq(&0u32) {
110-
println!("File content validation successful!\nno errors detected and no report will be generated :)");
110+
println!("File content validation successful!");
111+
buf.write_fmt(format_args!("{}", "No errors detected")).unwrap();
111112
} else {
112113
println!(
113114
"Some errors detected and a report is generated at location <{}>:",

src/cli/cli_opts.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
//! Command line options and associated functions
22
use clap::{AppSettings, Args, Parser, Subcommand};
33

4-
use crate::blocks::*;
5-
use crate::cemtex::*;
6-
use crate::csv::*;
4+
// use crate::blocks::*;
5+
// use crate::cemtex::*;
6+
// use crate::csv::*;
77

88
/// Command line options
99
#[derive(Parser)]
1010
#[clap(author = "Author: Geoffrey Borough<[email protected]>")]
11-
#[clap(version = "0.1.1")]
11+
#[clap(version = "0.1.2")]
1212
#[clap(about = "Utility to convert CSV file to Cemtex ABA file and validate Cemtex ABA file format", long_about = None)]
1313
#[clap(global_setting(AppSettings::DeriveDisplayOrder))]
1414
pub struct Cli {

src/cli/cli_utils.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
use std::{
2-
error::Error, fmt::Display, fmt::Write as fw, fs::File, io::Write, path::Path, process::exit,
3-
};
1+
use std::{error::Error, fmt::Write as fw, fs::File, io::Write, path::Path, process::exit};
42

53
use crate::blocks::*;
64
use crate::cemtex::*;

src/csv/csv_file.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ use config::{Config, File as ConfFile};
33
use csv::ReaderBuilder;
44
use serde::Deserialize;
55
use std::{
6-
alloc::System, collections::HashMap, convert::AsRef, error::Error, ffi::OsStr, fmt::Display,
7-
fs::File, path::Path, process::exit,
6+
collections::HashMap, convert::AsRef, error::Error, ffi::OsStr, fmt::Display, path::Path,
7+
process::exit,
88
};
99

1010
use crate::csv::*;

src/csv/csv_utils.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
use lazy_static::lazy_static;
55
use regex::Regex;
66
use serde::{Deserialize, Deserializer};
7-
use std::{ops::Sub, process::exit};
7+
use std::ops::Sub;
88

99
use crate::parser_utils::*;
1010
use crate::types::*;

src/errors.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//! Error types used for .aba file validation
2-
use std::fmt::Display;
32
use thiserror::Error;
43

54
/// Pre-filled error messages for line counts and data fields which are fixed in the blocks structures

src/lib.rs

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
//! Cemtexer is a utility for converting CSV file to Cemtex .aba file
2+
//!
3+
//! Also functions as a parser validator for ABA file
4+
5+
pub mod blocks;
6+
pub mod cli;
7+
pub mod csv;
8+
pub mod cemtex;
9+
pub mod errors;
10+
pub mod helper;
11+
pub mod parser_utils;
12+
pub mod types;

src/main.rs

-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
//! Cemtexer is a utility for converting CSV file to Cemtex .aba file
2-
//!
3-
//! Also functions as a parser validator for ABA file
4-
51
#![allow(unused_imports)]
62

73
mod blocks;

src/parser_utils.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Validation utility function for various .aba data fields
22
use lazy_static::lazy_static;
3-
use nom::character::{is_alphabetic, is_digit};
3+
use nom::character::is_digit;
44
use regex::Regex;
55
use std::ops::Sub;
66
use time::{format_description as Fd, Date as Td};

0 commit comments

Comments
 (0)