Repository: conan-io/conan

Issue:
[bug] Conan build command does not support conanfile.txt as described
### Description

The documentation about [build](https://docs.conan.io/2/reference/commands/build.html) command says:

```
usage: conan build [-h] [-v [V]] [--logger] [--name NAME] [--version VERSION] [--user USER] [--channel CHANNEL] [-of OUTPUT_FOLDER] [-b BUILD] [-r REMOTE | -nr] [-u] [-o OPTIONS_HOST] [-o:b OPTIONS_BUILD] [-o:h OPTIONS_HOST] [-pr PROFILE_HOST] [-pr:b PROFILE_BUILD]
                   [-pr:h PROFILE_HOST] [-s SETTINGS_HOST] [-s:b SETTINGS_BUILD] [-s:h SETTINGS_HOST] [-c CONF_HOST] [-c:b CONF_BUILD] [-c:h CONF_HOST] [-l LOCKFILE] [--lockfile-partial] [--lockfile-out LOCKFILE_OUT] [--lockfile-packages] [--lockfile-clean]
                   [path]

Install dependencies and call the build() method.

positional arguments:
  path                  Path to a folder containing a recipe (conanfile.py or conanfile.txt) or to a recipe file. e.g., ./my_project/conanfile.txt.
```

However, `conanfile.txt` is not acceptable by build command.

As the documentation is extracted from the command output, it should be fixed on Conan client first.


### Environment details

* Operating System+version: OSX 13
* Compiler+version: Apple-Clang 14
* Conan version: 2.0.0
* Python version: 3.10


### Steps to reproduce

1. mkdir /tmp/foo && cd /tmp/foo
2. echo "[requires]\nzlib/1.2.13" > conanfile.txt
3. conan build .
4. Or, conan build ./conanfile.txt

### Logs

```
% conan build .
ERROR: Conanfile not found at /private/tmp/foo/conanfile.py

% conan build ./conanfile.txt   
ERROR: A conanfile.py is needed, /private/tmp/conantxt/conanfile.txt is not acceptable
```


Discussion:
Anyone wanting to take a stab at this, I'll give some pointers:
 - Conan commands live under `conan/cli/commands`
 - Conan uses argparse for its CLI interaction
 - The solution for this one is easy: we _do_ require it to be a `.py` file, so the help text suggesting that `.txt` files in the command are valid is wrong, and should be changed, but as I'm not an enligh native speaker, I'll let you choose the best wording :)
 - If the PR you open has failing tests, do not worry! Some tests might rely on CLI output, we can fix those after the fact
I can take a stab at it 😄 
Amazing! thanks for the offer @kammce !

Resolving patch:
diff --git a/conan/cli/commands/build.py b/conan/cli/commands/build.py
--- a/conan/cli/commands/build.py
+++ b/conan/cli/commands/build.py
@@ -15,9 +15,9 @@ def build(conan_api, parser, *args):
     Install dependencies and call the build() method.
     """
     parser.add_argument("path", nargs="?",
-                        help="Path to a folder containing a recipe (conanfile.py "
-                             "or conanfile.txt) or to a recipe file. e.g., "
-                             "./my_project/conanfile.txt.")
+                        help='Path to a python-based recipe file or a folder '
+                             'containing a conanfile.py recipe. conanfile.txt '
+                             'cannot be used with conan build.')
     add_reference_args(parser)
     # TODO: Missing --build-require argument and management
     parser.add_argument("-of", "--output-folder",


Test patch: