The xonsh shell
xon.sh
xon.sh
Regexes in particular are new AFAIK, but zsh's extended globbing is already extremely powerful: http://www.refining-linux.org/archives/37/ZSH-Gem-2-Extended...
Bash also comes close, iirc.
But we use shells because of their ubiquity, not because of how nice scripting languages they are (they aren't). So I don't see myself ever using xonsh – I'm already glad when a system has bash and I don't have to figure out what "posix /bin/sh compliant" is supposed to mean this week.
! Just some imports.
USING: accessors smtp ;
! Create a new email object.
<email>
! That object is piped implicitly to these setter words.
! E.g., >>from: ( email new-address -- email )
"alice@example.com" >>from
{ "bob@example.com" } >>to
"Coffee?" >>subject
"You pick the time and place." >>body
! Pipe that object on to the “send-email” word.
send-email
Note how no local variables are necessary for simply plumbing data around—although of course you can use them if you want.The weirdest thing is probably that arithmetic in most concatenative languages is written in postfix, which you may find off-putting. But it’s no worse than Lisp’s prefix notation, and has some other benefits.
Factor also has an excellent interactive environment; the whole thing feels like a Lispy Smalltalk.
Postfix? I'm assuming a typo here but not sure what you meant.
Edit: Ah, I'm guessing it was supposed to be postscript. Makes more sense now.
Looks like an interesting language style though, I've been looking for a language that has the bash style piping baked into the language.
AST +
/ \
* 5
/ \
2 3
Infix 2 * 3 + 5
2 times 3 plus 5.
Prefix + * 2 3 5
Lisp (+ (* 2 3) 5)
The sum of the product of 2 and 3, and 5.
Postfix 2 3 * 5 +
With 2 and 3, multiply. Then with 5, add.I read postfix as in the mail server not as a synonym of suffix, thanks for the clarification.
Antonym, actually. Prefixes are literally on the other end of things than suffixes are ;)
Example: set lsOutput [pipethread::pipe exec ls | exec tac | foreach line { puts $outchan "[string length $line]:$line" } | { gets $inchan line; puts $outchan $line }]
Usage: https://chiselapp.com/user/rkeene/repository/pipethread/arti...
TCL works nice as a shell and is very elegant as a programming language. The famous equivalence of code and data is visible here, while still syntactically looking pretty normal.
Scheme (via https://scsh.net/about/about.html) is also worth looking into. S-exp based syntax looks strange at first, but you get used to it rather quickly.
Emacs Eshell is very similar to xonsh, but with Emacs Lisp instead of Python.
On Windows PowerShell is also a choice. It's both a shell and a sane, procedural programming language, with full access to dotNET.
Tulip (https://github.com/tulip-lang/tulip) express goals are to be good for both shell work and programming.
On the other hand, jq (https://stedolan.github.io/jq/) is just a DSL, but it turns out it's ok for doing more advanced work if you're familiar with functional programming.
Not to mention, almost every language with a REPL can be made into a shell/programming environment given enough library support. For example Python with IPython is a very decent shell and I think OCaml with utop could also be.
But this all depends on the OS; OS X only gives you an old version of BASH as the default shell and OpenBSD (and possibly other BSDs) require installing BASH through the ports tree.
Its there for humor, not a serious comparison tool. And I can respect that.
Also nice to see it respects XDG basedir.
I'll be trying it out today. I've been using zsh for a very, very long time and it's been really hard to get me to switch off it. This looks exciting.
My only concern is with ease of installation, especially on eg. debian servers. But that's out of the hands of the project :/
I've made a lot of use of the pause button, but it would be great to just be given a little more time to think.
I also used the pause in a couple of places (which is OK, that's what it's there for), and I almost certainly wouldn't have bothered watching it if it had been any longer.
I personally think this is an excellent example of a landing page. It contains a brief text summary of what the thing is and why you'd want to use it, a quick demo of what it does, and then links to further information.
But does it work? Here was what happened for me:
- The first section disappeared too fast.
- I thought that was odd and waited for the second section.
- The second section disappeared too fast.
- I closed the tab.
(or, for xon.sh, it may be time to update the video. I presumed you moved to the fancier domain at some point.)
As an example, gitsome [2] is powered by xonsh and might have benefitted from Xontrib.
I've found that xonsh + prompt-toolkit [3] is a nice combo that helps autocomplete the following:
* Shell commands
* Files and directories
* Environment variables
* Man pages
* Python (REPL too)
[1]: https://github.com/scopatz/xonsh/pull/829
[2]: https://github.com/donnemartin/gitsome
[3]: https://github.com/jonathanslenders/python-prompt-toolkit
How would this work over SSH? What if you're using a temporary shell as another user? Also, the terminal really shouldn't have to know what is going on in the shell in order to work reliably. Tools like tmux, screen… should not have to perform directory completion.
How is the program like 'ls' going to see a variable that is an array when originally it was a string delimited with ':'?
There are two things here: the command 'ls' that you type on your shell and the executable named 'ls' located in "/bin/ls" (or wherever) which can list directories. Most shells, when encounter a command X (say, 'ls') they see their 'context' to see if 'X' is defined. If yes, they will execute it. If not, they will assume that the X is an executable and try to execute it. That's what happening here.
Perhaps the following silly script helps?
#!/bin/ls
ls () {
echo "MYLS $*"
}
ls $*
HTHThere might be a way to specify the serialization of your array somewhere, but I can't find it in the doc.
I'd love to use it, really. But as long as it's not shipped by default with a popular Linux releases, I will not. My customers, Telcos, don't approve any "non standard" software in their server rooms.
Am I missing something to enable smart autocomplete?
$ git c<tab> completes to a folder, starting with c.
$ git cl<tab> does nothing.
(OS X, installed with pip.)
Personally, I just don't get what it solves that can't be solved with shells and programming languages pre-installed on every machine already. From a personal workstation/development box shell (I used GNU Emacs for dev/mail/usenet for over a decade), I can understand but for servers this may not be appropriate.
It is "cool" but I'd argue that most geeks don't even fully understand installed tools on their current machines, so this is "interesting" at best. It was someone's project to learn programming?
I may be being negative, but "meh".