A commandline tool to resolve URI Templates expressions as specified in RFC 6570.

URI

Are you tired to build, concat, replace URL(s) (via shell scripts sed/awk/tr) from your awesome commandline pipeline?

Well! here is the missing piece: uri!

         _            _  
o  / / _|     URI      |_ 
o / /   |_ Templates  _|

A commandline tool to resolve URI Templates expressions as specified in RFC 6570.

For a complete syntax reference check the RFC6570 specs here: https://tools.ietf.org/html/rfc6570#section-2.

Expressions are placeholders which are to be substituted by the values their variables reference.

http://example.org/~{username}/
http://example.org/dictionary/{term:1}/{term}
http://example.org/search{?q*,lang}

How to use uri

This tool takes a JSON as input data model containing the values โ€‹โ€‹of the variables. Example:

{
    "username": "scarlett",
    "term": "black widow",
    "q": {
        "a": "mars",
        "b": "jupiter"
    },
    "lang": "en"
}

You can pass this JSON as file using the -i flag:

$ uri -i data.json http://example.org/~{username}/{term:1}/{term}{?q*,lang}
http://example.org/~scarlett/b/black%20widow?q*

Or you can pipe it directly to the tool (and this the most interesting use case):

$ cat data.json | uri http://example.org/~{username}/{term:1}/{term}{?q*,lang}
http://example.org/~scarlett/b/black%20widow?q*

Using commandline pipes you can achieve tasks like this:

$ cat testdata/pets.json \
  | jq --raw-output '.pets[1] | {category: .species, year: .birthYear}' \
  | uri https://pets.api.com/{category}{?year} \
  | xargs curl

Installation Steps

In order to use the crumbs command, compile it using the following command:

go get -u github.com/lucasepe/uri

This will create the executable under your $GOPATH/bin directory.

Ready-To-Use Releases

If you don't want to compile the source code yourself, here you can find the executables for:

  • MacOS
  • Linux (amd64, arm7, arm64)
  • Windows

Credits

uri was possible thanks to the Joshua Tacoma URI Template library.

Owner
Luca Sepe
Software Craftsman [Golang / CLI tools].
Luca Sepe
Similar Resources

Curried commandline

curry Install $ go install github.com/lambdasawa/curry@latest $ brew tap lambdasawa/tap $ brew install lambdasawa/tap/curry Usage Basic usage. $ curry

Dec 10, 2021

A simple golang marshaller from commandline to a struct

flagmarshal SYNOPSIS A simple golang marshaller from commandline to a struct ParseFlags(structptr interface{}) error DESCRIPTION Very simple implement

Jan 22, 2022

Waiton - Commandline for executing command and waiting on output

waiton Commandline for executing command and waiting on output Output of waiton

Feb 4, 2022

A password manager as a CLI, where you can use a master password to retrieve a specified password and store it in your clipboard

A password manager as a CLI, where you can use a master password to retrieve a specified password and store it in your clipboard

Password manager Description CLI to store and retrieve passwords. The retrieved password will be stored on your clipboard! Usage 1.Start with Go go ru

Dec 16, 2021

The Code Templates for Basil CLI ๐ŸŒฟ

Basil Templates ๐ŸŒฟ This repository includes code templates for miscellaneous programming languages and technologies. Basil CLI uses these templates fo

Dec 15, 2021

This tool is a CLI-interactive tool for TA who use eeclass platform

NTHU eeclass TA helper. This tool is a CLI-interactive tool for TA who use eeclass platform. It helps TA to download all the submitted homework, and use CSV to record the score and comment, and upload CSV score directly to the eeclass platform with just 2 Enter key!

Dec 11, 2021

A command line tool that builds and (re)starts your web application everytime you save a Go or template fileA command line tool that builds and (re)starts your web application everytime you save a Go or template file

# Fresh Fresh is a command line tool that builds and (re)starts your web application everytime you save a Go or template file. If the web framework yo

Nov 22, 2021

fofax is a fofa query tool written in go, positioned as a command-line tool and characterized by simplicity and speed.

fofax is a fofa query tool written in go, positioned as a command-line tool and characterized by simplicity and speed.

fofaX 0x00 Introduction fofax is a fofa query tool written in go, positioned as

Jan 8, 2023

Nebula Diagnosis CLI Tool is an information diagnosis cli tool for the nebula service and the node to which the service belongs.

Nebula Diagnosis CLI Tool is an information diagnosis cli tool for the nebula service and the node to which the service belongs.

Jan 12, 2022
A flexible commandline tool for template rendering. Supports lots of local and remote datasources.
A flexible commandline tool for template rendering. Supports lots of local and remote datasources.

Read the docs at docs.gomplate.ca, chat with developers and community in the #gomplate channel on Gophers Slack gomplate is a template renderer which

Jan 5, 2023
Commandline tool to generate Cistercian numerals

cistercian Commandline tool to generate Cistercian numerals. Installation go get github.com/rhardih/cistercian Example usage Text $ cistercian 7323

Sep 30, 2022
tigrfont is a commandline tool for creating bitmap font sheets for TIGR from TTF or BDF font files.
tigrfont is a commandline tool for creating bitmap font sheets for TIGR from TTF or BDF font files.

tigrfont - bitmap font sheet generator for TIGR tigrfont is a commandline tool for creating bitmap font sheets for TIGR from TTF or BDF font files. TI

Dec 5, 2022
tinygo-used-files is a CLI tool that lists only the files to be built as specified by buildtag.

tinygo-used-files is a CLI tool that lists only the files to be built as specified by buildtag.

Feb 6, 2022
A command-line runner for Go expressions

grun grun is a command-line tool for evaluating Go expressions. It was inspired by runner which does the same for Rust. It constructs a little Go prog

Feb 10, 2022
Commandline Utility To Create Secure Password Hashes (scrypt / bcrypt / pbkdf2)

passhash Create Secure Password Hashes with different algorithms. I/O format is base64 conforming to RFC 4648 (also known as url safe base64 encoding)

Oct 10, 2022
Robust, flexible and resource-efficient pipelines using Go and the commandline
Robust, flexible and resource-efficient pipelines using Go and the commandline

Robust, flexible and resource-efficient pipelines using Go and the commandline Project links: Documentation & Main Website | Issue Tracker | Chat Why

Dec 25, 2022
An alternative syntax to generate YAML (or JSON) from commandline

yo An alternative syntax to generate YAML (or JSON) from commandline. The ultimate commanline YAML (or JSON) generator! ... I'm kidding of course! but

Jul 30, 2022
Teardown API for Commandline Based Applications
Teardown API for Commandline Based Applications

Building go build -ldflags "-s -w" -o ./build/api.exe ./ Get the latest XML from https://www.teardowngame.com/modding/api.xml Commands help list searc

Mar 1, 2022
NYAGOS - The hybrid Commandline Shell between UNIX & DOS
NYAGOS - The hybrid Commandline Shell between UNIX & DOS

The Nihongo Yet Another GOing Shell English / Japanese NYAGOS is the commandline-shell written with the Programming Language GO and Lua. There are som

Dec 30, 2022