mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-08-02 07:07:46 +00:00
show how flags work in nu (#145)
This commit is contained in:
parent
5589e2558d
commit
cf769798a6
1 changed files with 29 additions and 0 deletions
29
engine-q/nu_101/flag.nu
Normal file
29
engine-q/nu_101/flag.nu
Normal 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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue