forked from nushell/nu_scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
broken.nu
46 lines (42 loc) · 1002 Bytes
/
broken.nu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
### 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"
### }