Skip to content

Releases: jonaslu/ain

v1.4.1

11 Mar 19:05
Compare
Choose a tag to compare
  • Fix for bug with two env-vars on the same line (e g ${VAR1} ${VAR2}) was incorrectly expanded on two separate lines. Example with VAR1=1 VAR2=2:
[Headers]
${VAR1}=${VAR2}

Turned into:

curl \
-H "1=${VAR2} \
-H "${VAR1}=2"
  • Bump env-parse to 0.1.0

v1.4.0

25 Feb 12:48
Compare
Choose a tag to compare

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 g ENV="[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

16 May 10:03
Compare
Choose a tag to compare

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

28 Dec 19:32
Compare
Choose a tag to compare

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

24 Nov 20:10
Compare
Choose a tag to compare

This has happened since v1.2.0

  • Whitespace was significant between the key-values delimiter in the [Query] section (e g page = 3 became page+=+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

23 Nov 18:44
Compare
Choose a tag to compare

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

08 Sep 08:17
Compare
Choose a tag to compare

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.

v1.0.0

24 Jul 01:12
Compare
Choose a tag to compare

First relase of ain ๐ŸŒฎ