nushell: Support ignoring program errors when working with `;`

Related problem

No response

Describe the solution you’d like

Bash has:

  • && which means “continue only if everything before me succeeded”
  • || which means “run the stuff to the right only if stuff to the left failed”
  • ; which means “run the stuff to the right no matter what”

Nu has:

  • ; which means “continue only if everything before me succeeded”
  • do -i { ... }; which means “run the stuff to the right only if no shell errors occurred”

Proposal: add do -p { ... }; which means “run the stuff to the right only if no program errors occurred”. Combined with -i, you get “run the stuff to the right no matter what.”

Describe alternatives you’ve considered

No response

Additional context and details

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 19 (10 by maintainers)

Commits related to this issue

Most upvoted comments

@dandavison hey, I like that! @WindSoilder you get the old behavior and people like me can still activate only the error catching we need. Everybody on board?

@SUPERCILEX how about adding your low-level control as two new flags (names up to you), so we would have

  • -i meaning “ignore all”
  • (x TBD) meaning “ignore errors in external processes”
  • (y TBD) meaning “ignore nushell errors”

and the implementation of -i would be activating both your flags?

Maybe this isn’t too unpalatable because, after all, “ignore” didn’t specify what it was ignoring whereas your additions will be explicit about this.

I suspect the actual user interface here will evolve – as you’ve touched upon on the discussion – so I think it’s OK to have these low-level flags even if the original -i now becomes unnecessary in the presence of the two new flags.