Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
anki-code authored Feb 17, 2025
1 parent 1e610e7 commit 67b335c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1483,8 +1483,9 @@ echo """{"hello":'world'}"""
# {"hello":'world'}
```
### Python walrus operator in subprocess mode
### Python walrus operator in action
Use in subprocess:
```xsh
echo Hello @(_name := input('Name: ')) # Use `_` to keep env clean.
echo Hello again @(_name)
Expand All @@ -1493,6 +1494,14 @@ echo Hello again @(_name)
# Hello again Mike
```
Use with commands:
```xsh
(servers := $(@json echo '["srv1", "srv2"]'))
# list(['srv1', 'srv2'])
echo @(servers[0])
```
### Jump from aliases to CLI apps
If you realize that your alias becomes the app it's time to look at [xonsh-awesome-cli-app](https://github.com/anki-code/xonsh-awesome-cli-app).
Expand Down

0 comments on commit 67b335c

Please sign in to comment.