Repository: sqlfluff/sqlfluff

Issue:
--disable_progress_bar Flag Broken for Fix
### Search before asking

- [X] I searched the [issues](https://github.com/sqlfluff/sqlfluff/issues) and found no similar issues.


### What Happened

I ran `sqlfluff fix ${target} --dialect ansi --disable_progress_bar --force` on version 1.4.0 and got an error with exit code 2. Running with `--disable-progress-bar` appears to work fine, but it appears that compatibility with underscores was broken in version 1.4.0.

### Expected Behaviour

Should run as expected, with no error and no progress bar.

### Observed Behaviour

Exit code 2 and stderr:
```
Usage: sqlfluff fix [OPTIONS] [PATHS]...
        Try 'sqlfluff fix -h' for help.

        Error: No such option: --disable_progress_bar (Possible options: --disable-noqa, --disable-progress-bar)
```

### How to reproduce

Sql file:
```
SELECT foo FROM bar;
```

Command:
```
sqlfluff fix ${target} --dialect ansi --disable_progress_bar --force
```

### Dialect

ansi

### Version

python 3.10.3
sqlfluff 1.4.0 and up appears to have this problem (tested through 1.4.2)

### Configuration

No special configuration. Ran hermetically with `trunk`.

### Are you willing to work on and submit a PR to address the issue?

- [ ] Yes I am willing to submit a PR!

### Code of Conduct

- [X] I agree to follow this project's [Code of Conduct](https://github.com/sqlfluff/sqlfluff/blob/main/CODE_OF_CONDUCT.md)


Discussion:

Patch:
diff --git a/src/sqlfluff/cli/commands.py b/src/sqlfluff/cli/commands.py
index 16c33c514..e8de6549a 100644
--- a/src/sqlfluff/cli/commands.py
+++ b/src/sqlfluff/cli/commands.py
@@ -680,7 +680,7 @@ def do_fixes(lnt, result, formatter=None, **kwargs):
     return False  # pragma: no cover
 
 
-@cli.command()
+@cli.command(cls=DeprecatedOptionsCommand)
 @common_options
 @core_options
 @click.option(
@@ -710,9 +710,12 @@ def do_fixes(lnt, result, formatter=None, **kwargs):
     ),
 )
 @click.option(
+    "--disable_progress_bar",
     "--disable-progress-bar",
     is_flag=True,
     help="Disables progress bars.",
+    cls=DeprecatedOption,
+    deprecated=["--disable_progress_bar"],
 )
 @click.option(
     "--FIX-EVEN-UNPARSABLE",


Test patch:
diff --git a/test/cli/commands_test.py b/test/cli/commands_test.py
index ba8d55157..b1df3b80b 100644
--- a/test/cli/commands_test.py
+++ b/test/cli/commands_test.py
@@ -1775,6 +1775,46 @@ class TestProgressBars:
         assert r"\rrule L001:" in raw_output
         assert r"\rrule L049:" in raw_output
 
+    def test_cli_fix_disabled_progress_bar(
+        self, mock_disable_progress_bar: MagicMock
+    ) -> None:
+        """When progress bar is disabled, nothing should be printed into output."""
+        result = invoke_assert_code(
+            args=[
+                fix,
+                [
+                    "--disable-progress-bar",
+                    "test/fixtures/linter/passing.sql",
+                ],
+            ],
+        )
+        raw_output = repr(result.output)
+
+        assert (
+            "DeprecationWarning: The option '--disable_progress_bar' is deprecated, "
+            "use '--disable-progress-bar'"
+        ) not in raw_output
+
+    def test_cli_fix_disabled_progress_bar_deprecated_option(
+        self, mock_disable_progress_bar: MagicMock
+    ) -> None:
+        """Same as above but checks additionally if deprecation warning is printed."""
+        result = invoke_assert_code(
+            args=[
+                fix,
+                [
+                    "--disable_progress_bar",
+                    "test/fixtures/linter/passing.sql",
+                ],
+            ],
+        )
+        raw_output = repr(result.output)
+
+        assert (
+            "DeprecationWarning: The option '--disable_progress_bar' is deprecated, "
+            "use '--disable-progress-bar'"
+        ) in raw_output
+
 
 multiple_expected_output = """==== finding fixable violations ====
 == [test/fixtures/linter/multiple_sql_errors.sql] FAIL