23 October 2018

xonsh

there was small thread on the knoxdev's slack account about shells the other day. as i was trying to continue the discussion cleverly using the shell names as regular words in sentences, i did a quick search for available shells from my package manager (i.e. dnf search shell). as i was looking through the results, i found xonsh.

the description listed in my package manager tells me this is what it is:
Description  : xonsh is a Python-ish, BASHwards-compatible shell language and
             : command prompt. The language is a superset of Python 3.4 with
             : additional shell primitives. xonsh (pronounced *conch*) is
             : meant for the daily use of experts and novices alike.
i have toyed around with the idea of using python's interactive shell as my main terminal shell for some time, but i always felt it would be too hard to do some of the simple things, such as file management. sure, i could write equivalent scripts to do those tasks, but i never made the effort.

this accomplishes exactly what i wanted to do. with xonsh, i can do this:

~ $ ls -l gPodder/
total 124
-rw-r--r--. 1 mock mock 90112 Feb 19  2018 Database
drwxrwxr-x. 3 mock mock  4096 Feb 12  2018 Downloads
drwxrwxr-x. 2 mock mock  4096 Feb 19  2018 Logs
-rw-rw-r--. 1 mock mock  2715 Feb 19  2018 Settings.json
-rw-r--r--. 1 mock mock 20480 Feb 19  2018 gpodder.net
~ $ from datetime import datetime
~ $ datetime.now()
datetime.datetime(2018, 10, 23, 8, 35, 50, 863981)

there is much more to xonsh than just this. the full documentation can be found at http://xon.sh.