Repository: dotenv-linter/dotenv-linter (Rust)

Issue:
Print a message "Nothing to compare"
### Description

Print a message "Nothing to compare" in the absence of `.env` files for compare.

### Implementation

**Step 1:**

Add a method for [CompareOutput](https://github.com/dotenv-linter/dotenv-linter/blob/master/src/common/output/compare.rs#L8) to print the message "Nothing to compare" only if `is_quiet_mode == false`.

**Step 2:**

Call the method from the step 1 when [lines_map](https://github.com/dotenv-linter/dotenv-linter/blob/master/src/lib.rs#L105) is empty.

**Step 3:**

Add integration tests [here](https://github.com/dotenv-linter/dotenv-linter/blob/master/tests/output/compare.rs).

### Example

There aren't `.env` files in the current directory:

```sh
$ dotenv-linter compare .env1 .env2
Nothing to compare
```


Discussion:
Hi there, can I take this on as my first contribution? 
Sure, I'll assign you that issue.
The link to show where the integration tests should go is broken, where would you like these implemented?
> The link to show where the integration tests should go is broken, where would you like these implemented?

Integration tests should be located in `tests/output/compare.rs`.
do you mean `tests/compare/compare.rs`? I don't see a `tests/output/compare.rs` unless I am supposed to actually create the file myself. I'm pretty new to this so I'm sorry for getting a little lost 
> do you mean `tests/compare/compare.rs`? I don't see a `tests/output/compare.rs` unless I am supposed to actually create the file myself. I'm pretty new to this so I'm sorry for getting a little lost

Yes, you should create this file 🙂



Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a84102751..ca82a51fe 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 
 ## [Unreleased]
 ### 🚀 Added
+- Print a message "Nothing to compare" [#398](https://github.com/dotenv-linter/dotenv-linter/pull/398) ([@jakecorrenti](https://github.com/jakecorrenti))
 - Add action-hadolint [#400](https://github.com/dotenv-linter/dotenv-linter/pull/400) ([@iovanom](https://github.com/iovanom))
 - Add method to get substitution keys to LineEntry [#391](https://github.com/dotenv-linter/dotenv-linter/pull/391) ([@zotho](https://github.com/zotho))
 - Added a Fix Benchmark [#399](https://github.com/dotenv-linter/dotenv-linter/pull/399) ([@a4blue](https://github.com/a4blue))
diff --git a/src/common/output/compare.rs b/src/common/output/compare.rs
index 137f197ca..dd45c2963 100644
--- a/src/common/output/compare.rs
+++ b/src/common/output/compare.rs
@@ -21,4 +21,11 @@ impl CompareOutput {
     pub fn print_warnings(&self, warnings: &[CompareWarning]) {
         warnings.iter().for_each(|w| println!("{}", w))
     }
+
+    /// Prints 'Nothing to compare' in the absence of '.env' files for compare
+    pub fn print_nothing_to_compare(&self) {
+        if !self.is_quiet_mode {
+            println!("Nothing to compare");
+        }
+    }
 }
diff --git a/src/lib.rs b/src/lib.rs
index 69cdaccbc..0b7dec0d4 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -105,6 +105,7 @@ pub fn compare(
 
     // Nothing to check
     if lines_map.is_empty() {
+        output.print_nothing_to_compare();
         return Ok(warnings);
     }
 


Test patch:
diff --git a/tests/output/compare.rs b/tests/output/compare.rs
new file mode 100644
index 000000000..b02e90903
--- /dev/null
+++ b/tests/output/compare.rs
@@ -0,0 +1,20 @@
+use crate::common::TestDir;
+
+#[test]
+fn files_non_existent() {
+    let test_dir = TestDir::new();
+    let expected_output = format!("Nothing to compare\n");
+    let output = test_dir.test_command_success_and_get_output(&["compare", ".env1", ".env2"]);
+
+    assert_eq!(output, expected_output);
+}
+
+#[test]
+fn files_non_existent_in_quiet_mode() {
+    let test_dir = TestDir::new();
+    let output =
+        test_dir.test_command_success_and_get_output(&["compare", "--quiet", ".env1", ".env2"]);
+    let unexpected_output = format!("Nothing to compare\n");
+
+    assert_ne!(output, unexpected_output);
+}
diff --git a/tests/output/mod.rs b/tests/output/mod.rs
index 7edb210b9..36f712d4b 100644
--- a/tests/output/mod.rs
+++ b/tests/output/mod.rs
@@ -1,2 +1,3 @@
 mod check;
+mod compare;
 mod fix;