2 releases
0.1.1 | Mar 29, 2021 |
---|---|
0.1.0 | Mar 29, 2021 |
#41 in #public-api
22 downloads per month
Used in w3w-cli
8KB
176 lines
w3w-rs
Rust crates for accessing what3words public API
w3w-cli
CLI that provided access to what3words public API in batch mode.
Features
- Reasonably fast
- Zero system dependencies
- Supports most what3words public API endpoints, excluding speech recognition
- WIP: Interactive mode with autosuggest
Installation
Binary releases are not provided yet.
If you have a recent installation of Rust, you can use cargo install
:
cargo install w3w-cli
The binary name is w3w
for brevity.
Usage
You need to have a what3words API key.
You can provide it via -k|--key
flag or via W3W_API_KEY
env variable.
w3w
uses the same strategy as cat(1)
for handling files and standard input.
(WIP: w3w
doesn't currently support multiple files, you can use cat(1)
beforehand 😄)
If no [file]
is provided, input is read from stdout.
`w3w --help`
USAGE:
w3w [OPTIONS] --api-key <api-key> <SUBCOMMAND>
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
OPTIONS:
-k, --api-key <api-key> Your what3words API key [env: W3W_API_KEY]
--log-format <format> Log format to be used by tracing-subscriber [env: W3W_LOG_FORMAT=] [default: full]
[possible values: compact, full, json, pretty]
-o, --output-format <format> Output format to write to stdout [env: W3W_OUTPUT_FORMAT=] [default: plain]
[possible values: plain, json]
SUBCOMMANDS:
available-languages List all available language for three-word-addresses
help Prints this message or the help of the given subcommand(s)
to-3wa Convert geographic coordinates to three-word-addresses
to-coords Convert three-word-addresses to geographic coordinates
Examples
$ w3w to-coords <(echo "filled.count.soap")
51.520847,-0.195521
$ w3w -o json to-coords <(echo "filled.count.soap") | jq .coordinates
{ "lat": 51.520847, "lng": -0.195521 }
$ w3w to-3wa <(echo "51.520847,-0.195521")
filled.count.soap
$ w3w available-languages
English (en), German (de), ...
w3w-api
Rust library for what3words public API.
Contributing
All kinds of contributions are welcome, especially about increasing the coverage of upstream API.
License
This project is licensed under MIT license.
Dependencies
~6MB
~129K SLoC