1
Fork 0
mirror of https://github.com/RGBCube/nu_scripts synced 2025-08-01 22:57:46 +00:00

show how flags work in nu (#145)

This commit is contained in:
Michael Angerman 2022-02-14 21:20:59 -08:00 committed by GitHub
parent 5589e2558d
commit cf769798a6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

29
engine-q/nu_101/flag.nu Normal file
View file

@ -0,0 +1,29 @@
### So in this case you have to pass in a parameter
### Any parameter you type will work
### If you don't type a parameter you get an error
###
### The syntax for this is
### noflag hola
###
def noflag [x] {
echo $x
}
### The syntax for this is
### flag -f
### flag --flag
### If you type anything else it does not work
### For example
### flag -flag
### flag -f=hola
### flag -f hola
### flag -f = hola
def flag [
--flag(-f)
] {
echo $flag
}