Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rewardenv/reward-plugin-template
https://github.com/rewardenv/reward-plugin-template
Last synced: 12 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/rewardenv/reward-plugin-template
- Owner: rewardenv
- Created: 2023-01-13T16:30:47.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-02-03T09:18:36.000Z (almost 2 years ago)
- Last Synced: 2024-03-02T18:38:46.032Z (10 months ago)
- Language: Go
- Size: 30.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/funding.yml
Awesome Lists containing this project
README
# Reward Plugin Template
## Structure
```
.
├── cmd/ # CLI commands
│ ├── greeter/ # The Application's entrypoint. This contains the main.go file.
│ ├── root/ # root command (the top level command)
│ ├── greet/ # greet command
│ └── helpers.go # Helper functions for the CLI commands
├── go.mod
├── go.sum
└── internal/
├── config/ # The app configuration
└── logic/ # The logic of various commands.
# Keeping them in a separate package makes it easier to call one command's logic from another
# and vice-versa.
```## Running
```console
$ go run cmd/greeter/main.go greet Foo BarHello Foo Bar!
```## Running in Debug mode
```console
$ DEBUG=true go run cmd/greeter/main.go greet Foo BarDEBUG[2023-01-13T18:13:48+01:00] greet.go:12 reward-greeter/internal/logic.(*Client).RunCmdGreet() Creating a greeting...
Hello Foo Bar!
DEBUG[2023-01-13T18:13:48+01:00] greet.go:25 reward-greeter/internal/logic.(*Client).RunCmdGreet() ...greeting created.
```## Running with Command Line Flags
```console
$ go run cmd/greeter/main.go greet Foo Bar --add-cakesHello Foo Bar, here are some cakes 🎂!
```# Using with Reward
```console
$ go build -o reward-greeter cmd/greeter/main.go
$ mkdir -p ~/.reward/plugins.d
$ mv reward-greeter ~/.reward/plugins.d/$ reward greeter greet Foo Bar --add-cakes
Hello Foo Bar, here are some cakes 🎂!
```