enhancement: `k=@file` #22

Closed
bibby opened this Issue Mar 10, 2016 · 6 comments

Projects

None yet

3 participants

@bibby
bibby commented Mar 10, 2016

Great project, @jpmens .
An easily dismissable feature idea for you;

As with curl and vault, it could be nice to serialize the contents of a file using the @ prefix.

Example:

$ jo -p authors=@AUTHORS
{
   "authors": "Jan-Piet Mens <jpmens@gmail.com>"
}

Currently I'm using cat, which is fine, honestly.

$ jo -p authors="$(cat AUTHORS)"
@jpmens
Owner
jpmens commented Mar 11, 2016

I'd thought of doing that (in spite of feature creep :-)
What I don't like about it is that it clashes with my (probably bad) choice of using @ for indicating booleans: this makes my eyes water:

$ jo pass@T authors=@AUTHORS

Let's think about this a bit.

@itchyny
Contributor
itchyny commented Mar 11, 2016

We can already specify boolean with =true so dropping support for @T is easy to fix. The change breaks the backwards compatibility though.

@jpmens
Owner
jpmens commented Mar 11, 2016

The proposed change doesn't break backward compatibility. Consider the difference:

$ jo bool@T
$ jo file=@AUTHORS
@itchyny
Contributor
itchyny commented Mar 11, 2016

Oh, yes. You are right. Sorry.

@jpmens
Owner
jpmens commented Mar 11, 2016

@bibby I like this, and it's going to happen with a twist. Stay tuned. 😃

@jpmens jpmens added the enhancement label Mar 11, 2016
@jpmens jpmens added a commit that closed this issue Mar 11, 2016
@jpmens read JSON element values from files
	@file is read as is (trailing cr/nl is stripped)
	%file is read binary as is and base64-encoded

	closes #22
5b84494
@jpmens jpmens closed this in 5b84494 Mar 11, 2016
@bibby
bibby commented Mar 11, 2016

I look forward to it. jo has saved me quite a bit of time this week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment