Added readme information about standalone usage

This commit is contained in:
Geert Bevin 2023-01-03 12:51:22 -05:00
parent 9c103b8f9c
commit 5627d6db35

View file

@ -46,3 +46,45 @@ dependencies {
```
Instructions for using with Maven, Ivy, etc. can be found on [Maven Central](https://maven-badges.herokuapp.com/maven-central/com.uwyn/urlencoder).
## Standalone usage
UrlEncoder can be used on the command line also, both for encoding and decoding.
You have two options:
* run it with Gradle
* build the jar and launch it with Java
The usage is as follows:
```
Encode and decode URL parameters.
-e encode (default)
-d decode
```
### Running with Gradle
```shell
./gradlew run --args="-e 'a test &'" # -> a%20test%20%26
./gradlew run --args="%#okékÉȢ" # -> %25%23ok%C3%A9k%C3%89%C8%A2
./gradlew run --args="-d 'a%20test%20%26'" # -> a test &
```
### Running with Java
First build the jar file:
```shell
./gradlew clean jar
```
Then run it:
```shell
java -jar lib/build/libs/urlencoder-*.jar -e "a test &" # -> a%20test%20%26
java -jar lib/build/libs/urlencoder-*.jar "%#okékÉȢ" # -> %25%23ok%C3%A9k%C3%89%C8%A2
java -jar lib/build/libs/urlencoder-*.jar -d "a%20test%20%26" # -> a test &
```