A few days ago I released a new minor version of the ABS programming language, 1.7.0, which adds some syntactic sugar as well as improvments to the REPL — let’s get to them!
Reverse search in the REPL through ctrl+r
You can type something in the REPL and, by pressing
ctrl+r
, ABS will try to find the last command that
was executed that matches what you typed.
See it in action:
If you press ctrl+r
multiple times, the REPL will
walk its way back into the history to find the previous
command matching your input, until it reaches the end
of the history.
This feature has been implemented thanks to some improvements in go-prompt, so hats off to Masashi Shibata for helping out!
Number abbreviations
Easily my favorite, this feature allows you to append a suffix to a number in order to specify the “order of magnitude” of the number itself. Confused? It’s actually quite simple:
1 2 3 4 |
|
Suffixes are case-insensitive, so you can express 1000000
with either 1m
or 1M
.
Improvements to some builtin functions
We’ve decided to ease using some of the standard functions:
you can now, for example, print a message before exiting
a script directly through the exit
function.
Your code would have previously looked like:
1 2 3 4 |
|
while now you can simply do:
1 2 3 |
|
Similarly, we made it easier to use the replace
function on
strings: you can now omit the last argument (number of replacements),
with its default value being -1
(no limit):
1 2 3 4 5 |
|
and you can now also specify a list of characters to replace:
1
|
|
Now what?
Install ABS with a simple one-liner:
1
|
|
…and start scripting like it’s 2019!