Files
dotfiles/dot_config/nushell/nu_scripts/sourced/nu_101/broken.nu
Cian Hughes 896af887ca Changed . token to _dot
This change allows the dotfiles to work with chezmoi (e.g: on windows)
and improves grepability with neovim/telescope
2024-11-07 13:52:17 +00:00

47 lines
1002 B
Nu

### These examples are here to show the user
### How the parser works by showing examples that will not parse
### The beginning nushell script writer / user may get confused
### as to why their script is not working
###
### If you uncomment any of the defs below these are
### the error messages you will see
#
#
#
### Examples p1 - p3 below elucidate the following idea:
### That a brace has to be on the same line as the def
###
###
### Error: nu::parser::missing_positional
### The error message is: "Missing required positional argument"
### missing block
###
### help: Usage: def <def_name> <params> <block>
###
#
### https://github.com/nushell/nushell/issues/2972
#
### All of these examples will not parse.
### def p1 [arg]
### { echo $arg }
### def p2 [arg]
### {
### echo $arg }
### def p3 [arg]
### {
### echo $arg
### }
### This breaks because you need a space between
### between foo and the left bracket
### def foo[] {
### "bar"
### }
### This works
### def foo [] {
### "bar"
### }