gitignore_template_generator/
constant.rs

1pub mod error_messages {
2    pub const CMD_EXECUTION_FAILURE: &str = "Failed to execute command";
3    pub const BODY_PARSING_ISSUE: &str =
4        "An error occurred during body parsing";
5    pub const FILE_READ_TO_STRING_FAILURE: &str =
6        "Failed to read expected output file";
7    pub const REGEX_NO_MATCH: &str =
8        "Actual output <{actual}> did not match expected pattern <{expected}>";
9    pub const COMMAS_NOT_ALLOWED: &str =
10        "Commas are not allowed in template names";
11    pub const API_CALL_FAILURE: &str =
12        "An error occurred during the API call: {error}";
13    pub const HTTP_400: &str = "http status: 400";
14    pub const AUTHOR_INFOS_NOT_AVAILABLE: &str =
15        "Author information not available.";
16}
17
18pub mod help_messages {
19    pub const TEMPLATE_NAMES: &str =
20        "A non-empty list of gitignore template names";
21    pub const AUTHOR: &str = "Print author";
22    pub const SERVER_URL: &str = "The gitignore template generator service url";
23    pub const HELP: &str = "Print help";
24    pub const VERSION: &str = "Print version";
25}
26
27pub mod cli_options {
28    use crate::helper::CliOptionName;
29
30    pub const AUTHOR: CliOptionName = CliOptionName {
31        short: 'a',
32        long: "author",
33    };
34    pub const SERVER_URL: CliOptionName = CliOptionName {
35        short: 's',
36        long: "server-url",
37    };
38    pub const HELP: CliOptionName = CliOptionName {
39        short: 'h',
40        long: "help",
41    };
42    pub const VERSION: CliOptionName = CliOptionName {
43        short: 'V',
44        long: "version",
45    };
46}
47
48pub mod parser_infos {
49    pub const ABOUT: &str = "Generate templates for .gitignore files";
50}
51
52pub mod exit_status {
53    pub const SUCCESS: i32 = 0;
54    pub const GENERIC: i32 = 2;
55    pub const BODY_PARSING_ISSUE: i32 = 3;
56}
57
58pub mod template_generator {
59    pub const BASE_URL: &str = "https://www.toptal.com";
60    pub const URI: &str = "/developers/gitignore/api";
61}
62
63pub mod path {
64    pub const TEST_EXPECTATIONS: &str = "tests/expected";
65}
66
67pub mod regex {
68    pub const SEMVER_VERSION: &str = r"[0-9]+\.[0-9]+\.[0-9]+";
69}