Repository navigation
Description
What version of Bun is running?
1.0.0+822a00c4d508b54f650933a73ca5f4a3af9a7983
What platform is your computer?
Linux 6.5.1 x86_64 unknown
What steps can reproduce the bug?
$ bunx --bun echo
$ bun x --bun echo
--bun
$ bun --bun x echo
$ bunx -b echo
-b
$ bun x -b echo
-b
$ bun -b x echo
-b
$ bunx --help echo --help echo --help
--help --help echo --help
$ bunx /usr/bin/env echo
error: unrecognised dependency format: @/usr/bin/env
$ bunx env echo
What is the expected behavior?
The following assumes that echo is a npm package that prints CLI arguments, instead of an actual echo package.
In reality it should show error: could not determine executable to run for package echo
$ bunx --bun echo
$ bun x --bun echo
$ bun --bun x echo
$ bunx -b echo
$ bun x -b echo
$ bun -b x echo
$ bunx --help echo --help echo --help
usage: bunx [bun flags]... package[@version] [flags or arguments to pass through]...
bunx runs an npm package executable, automatically installing into a global shared cache if not installed in node_modules.
...omitted
$ bunx /usr/bin/env echo
error: unrecognised dependency format: @/usr/bin/env
$ bunx env echo
error: could not determine executable to run for package env
There a many points for consideration, npm and pnpm are weird in their CLI.
I suggest the following:
-
correctly add
-bflag as alias for--bun -
every argument that starts with
-is a flag to bun until a required flag that starts with anything else is encountered
bunx [bun_flags]... package[@version] [pkg_args]...
bun [bun_flags]... x [bun_flags]... package[@version] [pkg_args]... -
bunxandbun xshould have exactly the same behaviour, note that this is not the case for npm or pnpm -
add npm
-cflag alternative to run files in the shell, my suggestion is
bun shell [-p <pkg>]... [cmd_and_args]... -
add
execcommand and makexan alias of it
Point [4] requires standalone issue.
What do you see instead?
No response
Additional information
Related issue #4972
Activity