Repository: cookiecutter/cookiecutter

Issue:
Cannot properly override boolean variable from command line
* Cookiecutter version: 2.4.0
* Template project url: N/A
* Python version: 3.10
* Operating System: Linux

### Description:

I tried to use the boolean variable. It works great when generating from interactive prompt. But when I try to use --no-input with command line context it doesn't propagate words like "no" or "false" as false value, but rather it seems to take it as string value, so if I pass an empty string it will be evaluated to false.

Here is my cookiecutter.json:
```json
{
  "project_name": "test_boolean",
  "generate_text": true
}
```

I have a file with template:
```
{% if cookiecutter.generate_text %}
Hello, world!
{% endif %}
```

If I run `cookiecutter --no-input -f . generate_text=false`, the generated file still has the "Hello, world!". But if i use `generate_text=""` the generated file will be empty.


Discussion:

Resolving patch:
diff --git a/cookiecutter/generate.py b/cookiecutter/generate.py
--- a/cookiecutter/generate.py
+++ b/cookiecutter/generate.py
@@ -15,6 +15,7 @@
 from binaryornot.check import is_binary
 from jinja2 import Environment, FileSystemLoader
 from jinja2.exceptions import TemplateSyntaxError, UndefinedError
+from rich.prompt import InvalidResponse
 
 from cookiecutter.exceptions import (
     ContextDecodingException,
@@ -24,6 +25,7 @@
 )
 from cookiecutter.find import find_template
 from cookiecutter.hooks import run_hook_from_repo_dir
+from cookiecutter.prompt import YesNoPrompt
 from cookiecutter.utils import (
     create_env_with_context,
     make_sure_path_exists,
@@ -103,6 +105,16 @@ def apply_overwrites_to_context(
                 context_value, overwrite, in_dictionary_variable=True
             )
             context[variable] = context_value
+        elif isinstance(context_value, bool) and isinstance(overwrite, str):
+            # We are dealing with a boolean variable
+            # Convert overwrite to its boolean counterpart
+            try:
+                context[variable] = YesNoPrompt().process_response(overwrite)
+            except InvalidResponse as err:
+                raise ValueError(
+                    f"{overwrite} provided for variable "
+                    f"{variable} could not be converted to a boolean."
+                ) from err
         else:
             # Simply overwrite the value for this variable
             context[variable] = overwrite


Test patch:
diff --git a/tests/test_generate_context.py b/tests/test_generate_context.py
--- a/tests/test_generate_context.py
+++ b/tests/test_generate_context.py
@@ -8,6 +8,7 @@
 
 from cookiecutter import generate
 from cookiecutter.exceptions import ContextDecodingException
+from cookiecutter.prompt import YesNoPrompt
 
 
 def context_data():
@@ -362,3 +363,24 @@ def test_apply_overwrites_in_nested_dict_additional_values() -> None:
     )
 
     assert generated_context == expected_context
+
+
+@pytest.mark.parametrize(
+    "overwrite_value, expected",
+    [(bool_string, {'key': True}) for bool_string in YesNoPrompt.yes_choices]
+    + [(bool_string, {'key': False}) for bool_string in YesNoPrompt.no_choices],
+)
+def test_apply_overwrites_overwrite_value_as_boolean_string(overwrite_value, expected):
+    """Verify boolean conversion for valid overwrite values."""
+    context = {'key': not expected['key']}
+    overwrite_context = {'key': overwrite_value}
+    generate.apply_overwrites_to_context(context, overwrite_context)
+    assert context == expected
+
+
+def test_apply_overwrites_error_overwrite_value_as_boolean_string():
+    """Verify boolean conversion for invalid overwrite values."""
+    context = {'key': True}
+    overwrite_context = {'key': 'invalid'}
+    with pytest.raises(ValueError):
+        generate.apply_overwrites_to_context(context, overwrite_context)