Construct and build URLs from JSON
lefuturiste opened this issue · 5 comments
Very cool and useful program.
I was wondering:
The very same JSON output that this util give when using --json
could be processed by some other program (like jq) and then this program could reconstruct a new URL. I known that we already have the set flag but for some case it could be useful to use jq for more complex manipulation
Examples:
echo "https://example.org/helloworld" | trurl --json | trurl --construct
should give the same url
Could this be interesting as a feature of this program?
I am not entirely convinced this is where we need to go.
That would require the use of a JSON parser library.
Setting components can be done in many ways with set and iterate etc, a JSON "import" can probably not be made to support the same range of features.
But I'm willing to listen to what people say.
Similar to #159, it wouldn't be unreasonable to use a Python script or something to get this feature, and then we wouldn't need to require a JSON parser to build trurl.
okay, knowing the fact that you don't have a JSON parser I understand that this would be the role of another program or a jq script.
You would probably write a script to receive JSON from trurl, massage the components anyway you want, and then rather create a new trurl command line to create a new URL again.
I hear very little love for this idea. Maybe we can reconsider in a future when we know better where trurl has gone.