Last active
August 25, 2016 12:44
-
-
Save gforsyth/da446e60e4f67dacbbcf217b650bcd2f to your computer and use it in GitHub Desktop.
xonsh asciicinema script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # welcome to xonsh | |
| 1 + 1 | |
| # woah! | |
| # env variables are typed | |
| $HOME | |
| x = 'US' | |
| ${x + 'ER'} | |
| # $PATH is a list of strings | |
| $PATH | |
| $PATH.pop(3) | |
| $PATH.insert(3, 'whatever I just popped') | |
| # regex globbing for file names | |
| ls -l `xonsh/\w+?(ci|ic).*` | |
| # tab completion everywhere | |
| cd xonsh | |
| git pu | |
| # aliases can be lists or functions | |
| aliases['ls'] | |
| aliases['banana'] = lambda args, stdin=None: 'My spoon is too big!\n' | |
| banana | |
| # multiline input support | |
| if True: | |
| ls -l | |
| else: | |
| print("Hi!") | |
| ^^^ then scroll up, change true to False, run again | |
| # xonsh environment shortcut | |
| ${...} | |
| # but the environment is a dictionary, so we can change things | |
| # in a context manager! | |
| with ${...}.swap(TERM='IAMABANANA'): | |
| $TERM | |
| # did we mention that xonsh is a superset of python? | |
| import numpy | |
| print(numpy.random.random((4, 4)) | |
| # but we're still in the shell | |
| ls |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment