bun icon indicating copy to clipboard operation
bun copied to clipboard

Add `--cmd` to execute specific commands for Bun shell

Open linux-china opened this issue 10 months ago • 2 comments

What is the problem this feature would solve?

Most tools/Libraries use -c to specify command to be executed in the shell, such as bash -c "echo 'bash is executed'".

Examples as following:

set shell := ["python3", "-c"]
set shell := ["bash", "-uc"]
set shell := ["zsh", "-uc"]
set shell := ["fish", "-c"]
set shell := ["nu", "-c"]

Could Bun supply --cmd option to execute command?

What is the feature you are proposing to solve the problem?

Execute shell command by --cmd from command line, and now -c is used for config load.

What alternatives have you considered?

No response

linux-china avatar Apr 05 '24 05:04 linux-china

it is not documented yet but bun exec serves this purpose.

paperclover avatar Apr 05 '24 23:04 paperclover

As per the child_process.exec and child_process.execSync's shell option documentation:

shell: Shell to execute the command with. See Shell requirements and Default Windows shell. Default: '/bin/sh' on Unix, process.env.ComSpec on Windows.

Shell requirements # The shell should understand the -c switch. If the shell is 'cmd.exe', it should understand the /d /s /c switches and command-line parsing should be compatible.

it would be useful if the bun binary were to support this convention for the bun shell.

kzc avatar Apr 06 '24 05:04 kzc