Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/blakewilliams/amaro
Experimental CLI for applications
https://github.com/blakewilliams/amaro
Last synced: 16 days ago
JSON representation
Experimental CLI for applications
- Host: GitHub
- URL: https://github.com/blakewilliams/amaro
- Owner: BlakeWilliams
- Created: 2023-12-18T16:59:35.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-01T23:52:25.000Z (about 1 month ago)
- Last Synced: 2024-12-11T08:46:28.791Z (23 days ago)
- Language: Go
- Size: 146 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Amaro
If frameworks were operating systems, Rails would be Ubuntu and Amaro would be
Arch. Amaro attempts to include all the bells and whistles needed for
production apps, but the glue and application is up to you. (guided, of course)Amaro is a composable application framework for Go, aiming to create a small
ecosystem of components like http routers, job runners, test helpers, and other
frameworks/tooling necessary to make complex Go applications.## Getting Started
The core Amaro package (github.com/blakewilliams/amaro) is focused on creating
runnable commands in your project, and is how other packages hook into your
project.For example, to get started with a web project you would create
`cmd/appname/main.go` and include the following:```go
package mainimport (
"context""github.com/blakewilliams/amaro"
"github.com/you/project/core"
)func main() {
// Application must implement `AppName()` and `Log()`
runner := amaro.NewApplication(&core.Application{
// your application configuration
})
runner.Execute(context.TODO())
}
```This requires a "core" application, that must implement the `amaro.Application` interface.
### Adding a command
Adding commands is simple, implement the `Command[T]` interface on a struct
(typically a dedicated struct):```
type GreetCmd[T amaro.Application] struct {
Name string
}func (g *GreetCmd[T]) CommandName() string { return "greet" }
func (g *GreetCmd[T]) CommandDescription() string { return "Greets you" }
// The actual command
func (g *GreetCmd[T]) RunCommand(ctx context.Context, app T) {
app.Log(fmt.Sprintf("Hello, %s!", g.Name))
}
```Then register your command in your `main` function like
`runner.RegisterCommand(&GreetCmd{Name: "Fox Mulder"})` and run your command
with `go run greet`!## Web
TODO document how to bootstrap a web app
### Sessions
### Flash messages (notices)
### CSRF