Releases: jonaslu/ain
v1.6.0
Features
--vars
flag added for setting environment variables via ain (suggested in #29)
Add usable real world examples as a folder on the project home page
Bugfixes
$(printf ${VAR})
stopped working in 1.5 and would output ${VAR}
Remove the exclamation mark (filename.ain!) in fatals
Consumed sections (such as [Config] will not be processed when substituting executables)
Dev features
e2e tests added with code coverage
Added a taskfile for less typing and frail memory
V1.5.0
Features
Backend stdout and stderr are now captured and printed separately (eb9fa6c). More info in the running ain
section. Closes #17
Better formatting of post backend call errors (acbbc63)
Add escaping to comments, envvars and executables #, ${ and $(
. Closes #25
All redeclared sections shown as fatals (36bf826)
Empty template error message dropped (8d138be)
Bugfixes
Report temp-file error before exiting (e8d6f5e)
[Body] was not compated if last in file (ddf9f91)
v1.4.1
v1.4.0
Major refactor of the template parsing internals
Parsing and running of executables was previously done file by file and then the result was assembled.
The Timeout in the [Config]
was only local for the parsed file.
A Timeout=2
would not be enforced in any succeeding file. I e a bug.
Parsing has been refactored into turning each template file into a data-structure where it's original lines can be expanded
by environment variables and executables. At any time this structure can be queried for
one or several headings and they will be returned with the expanded content so far.
Thus the flow is now:
Expand all environment variables across all files.
Capture the [Config]
section from all files and assemble the result.
Use the Timeout=x
parameter in the assembled [Config]
:s.
Run all the executables and enforce the assembled Timeout=x parameter from above.
The executables output is inserted as expanded content into the data-structure.
Then the data-structure is queried for the rest of the known headers
and the output is assembled into a BackedInput. This BackendInput is passed to
the selected backend along with the Timeout= context making
the timeout apply both to executables and the running the backend. As it should have been.
Expanded context
Fatals with ${ENVVARS}
or ${executables}
can become hard to understand,
especially since both can return any text including newlines. The extreme
case is a template with just one ${ENVVAR}
that expands in turn to a whole
valid template (with executables).
Since the data-structure holds expanded lines fatals now include what the template
contains at the time of the fatal. If the fatal happens on a line with expanded content
a second paragraph with the expanded context is included.
This will make debugging templates with lots of expanded content easier.
Up to three lines of expanded context is printed if the lines preceding or succeeding the fatal
line contains any expanded context in turn. "Line-rows" in the expanded context is the
original template line where the expansion happened.
[Body] and whitespace
Retain empty newlines in the [Body] section. And make the actual content the first and last non-empty line.
And clarify that in the README.
Bugfixes
Timeout=x
now applies to the entire run.- Allow quoted end parens in executables. E g
${node -e 'console.log("yo")')
would previously fail because the first closing parens would be interpreted as closing of the executable. Allow for nested parens inside quotes. - If the last lime is empty line in the template this is printed in the fatals context, it was previously discarded.
- Whitespace in
" yes "
was trimmed to"yes "
. Retain any whitespace in quoted text. - Whitespace and empty newlines in
[Body]
are now kept. It was previously discarded. - Line numbers on empty headings were off by one.
- Allow empty template when launching the empty template in
$EDITOR
(e g empty.ain!), since we don't know if it's going to be empty until after the editing has taken place. - Fix that an
${ENV}
with newlines (e gENV="[config]\nTimeout=1"
) was ignored since any expanded context wasn't split on newlines until after executables had run. Now env-vars are split on newline. Note that this only really applied to the[Config]
section since newline splitting (on all lines) was done after executables ran and it's only[Config]
that applies before executables.
v1.3.0
This has happened since v1.2.2
- Add levenshtein distance suggestion if backend or an environment variable is misspelled.
- Fix so $EDITOR can contain extra command line switches (so vs-code can be used with --no-fork)
- Make ain respect $VISUAL first and $EDITOR second
- If no $EDITOR and the default vim is not found on the system, error out with a message.
v1.2.2
This has happened since v1.2.1
- Parsing of quotes in strings was incorrect and did not handle a quote in the middle of a string (e g wo" rd "s). This should not break any existing templates as it never worked until now.
- File names were trimmed for white space which is incorrect since any char except
/
or null is valid on unix. Added a clarification to the README.md. - Custom error message when there are no file names sent over a pipe.
v1.2.1
This has happened since v1.2.0
- Whitespace was significant between the key-values delimiter in the [Query] section (e g
page = 3
becamepage+=+3
). This will be confusing to most and not very helpful. Trim it in the [Query] section but retain it's significance in the [Host] section. This makes [Host} more raw and [Query] more user-friendly. This is hopefully not a breaking change for anyone yet - if it is - manually encode the spaces as plus signs (+) or move the parameter you need spaces in into the [Host} section.
v1.2.0
This has happended since v1.1.0:
- A new [Query] section introduced as suggested in issue #9. This appends query-parameters to the URL given in the [Host] section. The key-value pair delimiter can be configured in the [Config] section.
- URL-encoding is taken care of both in the URL-path and the query-string. Ain handles both partially encoded strings and non-encoded strings.
v1.1.0
This has happended since v1.0.0:
- wget has been added as a backend. With the unholy trio of curl, httpie and wget there's a big chance of at least one of them being installed on your mac / linux / windows 10 box (or any remote linux server) so you don't have to.
- Ain trims any trailing empty lines in the output from executables.
ain -b
scans your path and tells you if you have curl, httpie or wget installed so you don't have to know or check your$PATH
yourself.