This repository has been archived by the owner on Feb 26, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from korosuke613/support-output
feat: support output
- Loading branch information
Showing
4 changed files
with
104 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,5 @@ dist/ | |
|
||
input.json | ||
template.txt | ||
output.txt | ||
main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,81 @@ | ||
# tempura | ||
|
||
## Install | ||
|
||
Download from [Releases](https://github.com/korosuke613/tempura/releases). or `docker pull ghcr.io/korosuke613/tempura`. | ||
|
||
## Getting Started | ||
using binary | ||
``` | ||
❯ tempura --input-string '{"Name": "John", "Message": "Good"}' --template-string 'Hello {{.Name}}, {{.Message}}' | ||
Hello John, Good | ||
``` | ||
|
||
or using docker | ||
|
||
``` | ||
❯ docker run --rm ghcr.io/korosuke613/tempura --input-string '{"Name": "John", "Message": "Good"}' --template-string 'Hello {{.Name}}, {{.Message}}' | ||
Hello John, Good | ||
``` | ||
|
||
|
||
## Example | ||
|
||
### input multiline template | ||
``` | ||
❯ tempura \ | ||
--input-string '{"Name": "John", "Message": "Good"}' \ | ||
--template-string \ | ||
'Hello {{.Name}}, | ||
{{.Message}}' | ||
Hello John, | ||
Good | ||
``` | ||
|
||
### read template and inputs | ||
|
||
`input.json` | ||
```json | ||
{ | ||
"Name": "John", | ||
"Message": "Good" | ||
} | ||
``` | ||
|
||
`template.txt` | ||
```text | ||
Hello {{.Name}}, | ||
{{.Message}} | ||
``` | ||
|
||
``` | ||
❯ tempura -i input.json -t template.txt | ||
Hello John, | ||
Good | ||
``` | ||
|
||
### output to file | ||
``` | ||
❯ tempura -o ./output.txt | ||
❯ cat ./output.txt | ||
Hello John, | ||
Good | ||
``` | ||
|
||
### Options | ||
``` | ||
❯ tempura -h | ||
A Fast and Flexible Template Fill Generator built with love by korosuke613 in Go. | ||
Usage: | ||
tempura [flags] | ||
Flags: | ||
-h, --help help for tempura | ||
-i, --input-filepath string input file name (default "input.json") | ||
--input-string string input string | ||
-o, --output string output file name | ||
-t, --template-filepath string template file name (default "template.txt") | ||
--template-string string template string | ||
-v, --version show version | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters