uv run: List available scripts when a script is not specified (#7687)

Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
## Summary

This PR adds the ability to list available scripts in the environment
when `uv run` is invoked without any arguments.
It somewhat mimics the behavior of `rye run` command
(See https://rye.astral.sh/guide/commands/run).

This is an attempt to fix #4024.

## Test Plan

I added test cases. The CI pipeline should pass.

### Manuel Tests

```shell
❯ uv run
Provide a command or script to invoke with `uv run <command>` or `uv run script.py`.

The following scripts are available:

normalizer
python
python3
python3.12

See `uv run --help` for more information.
```

---------

Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
Co-authored-by: Zanie Blue <contact@zanie.dev>
This commit is contained in:
Kemal Akkoyun 2024-10-08 21:34:50 +02:00 committed by GitHub
parent 282fab5f70
commit 1a39ffe391
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 152 additions and 16 deletions

View file

@ -37,7 +37,6 @@ mod python_version;
mod target;
mod version_files;
mod virtualenv;
mod which;
#[cfg(not(test))]
pub(crate) fn current_dir() -> Result<std::path::PathBuf, std::io::Error> {