nushell/crates/nu-command/src/filesystem
Eugeen Sablin 9e1e2a4320
provide env to commands and try to start provided path (#10302)
fixes #8551

# Description
Use `open::commands` function to get list of command available for
starting given path. run commands directly, providing environment, until
one of them is successful.

example of output if start was not successful:
```
~\code\nushell> start ..\nustart\a.myext                                                                    09/12/2023 01:37:55 PM
Error: nu:🐚:external_command

  × External command failed
   ╭─[entry #1:1:1]
 1 │ start ..\nustart\a.myext
   ·       ─────────┬────────
   ·                ╰── No command found to start with this path
   ╰────
  help: Try different path or install appropriate command

        Command `cmd /c start "" "..\nustart\a.myext"` failed with exit code: 1
```

# User-Facing Changes
`start` command now provides environment to the external command. This
is how it worked in `nu 0.72`, see linked issue.

# Tests + Formatting
`start` command didn't have any tests and this PR does not add any.
Integration-level tests will require setup specific to OS and
potentially change global environment on testing machine. For unit-level
test it is possible to test `try_commands` function. But is still runs
external commands, and robust test will require apriori knowledge which
commands are necessary successful to run and which are not.
2023-09-12 14:03:41 +02:00
..
cd.rs Move Value to helpers, separate span call (#10121) 2023-09-03 07:27:29 -07:00
cd_query.rs Fix typos by codespell (#7600) 2022-12-26 02:31:26 -05:00
cp.rs Move Value to helpers, separate span call (#10121) 2023-09-03 07:27:29 -07:00
glob.rs Move Value to helpers, separate span call (#10121) 2023-09-03 07:27:29 -07:00
ls.rs Move Value to helpers, separate span call (#10121) 2023-09-03 07:27:29 -07:00
mkdir.rs Move Value to helpers, separate span call (#10121) 2023-09-03 07:27:29 -07:00
mod.rs use uutils/coreutils cp command in place of nushell's cp command (#10097) 2023-09-08 13:57:38 -05:00
mv.rs Move Value to helpers, separate span call (#10121) 2023-09-03 07:27:29 -07:00
open.rs Document that open looks up from subcommands (#10255) 2023-09-06 19:26:53 +02:00
rm.rs Clean up trash support on Android (#10225) 2023-09-05 14:38:23 +02:00
save.rs Spanned Value step 1: span all value cases (#10042) 2023-08-25 08:48:05 +12:00
start.rs provide env to commands and try to start provided path (#10302) 2023-09-12 14:03:41 +02:00
touch.rs Document and critically review ShellError variants - Ep. 2 (#8326) 2023-03-06 11:31:07 +01:00
ucp.rs Fix variables not allowed in ucp (#10304) 2023-09-10 17:54:33 -05:00
util.rs Fix cp -u/mv -u when the dst doesn't exist (#9662) 2023-07-12 18:12:59 +02:00
watch.rs Move Value to helpers, separate span call (#10121) 2023-09-03 07:27:29 -07:00