mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-04-24 19:51:14 -03:00
add function --shadow-builtin flag
It's currently too easy for someone to bork their shell by doing something like `function test; return 0; end`. That's obviously a silly, contrived, example but the point is that novice users who learn about functions are prone to do something like that without realizing it will bork the shell. Even expert users who know about the `test` builtin might forget that, say, `pwd` is a builtin. This change adds a `--shadow-builtin` flag that must be specified to indicate you know what you're doing. Fixes #3000
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
function: function name shadows a builtin so you must use '--shadow-builtin'
|
||||
fish: function pwd; end
|
||||
^
|
||||
yes, it failed as expected
|
||||
function: function name does not shadow a builtin so you must not use '--shadow-builtin'
|
||||
fish: function not_builtin --shadow-builtin; end
|
||||
^
|
||||
yes, it failed as expected
|
||||
|
||||
Reference in New Issue
Block a user