go package for grgd
grgd is a cli framework extending "github.com/urfave/cli" with user, project and service definitions. Create your own powerful cli with persistence.
Test the embeded example cli:
go run example/main.go
Here you should say what actually happens when you execute the code above.
_ version 0.0.1 |
___ __ __ __ _ _ __ ___ _ __ | | ___ profile gregor |
/ _ \ \ \/ / / _` | | '_ ` _ \ | '_ \ | | / _ \ project examplestack |
| __/ > < | (_| | | | | | | | | |_) | | | | __/ grgdDir /Users/gregor/.grgd |
\___| /_/\_\ \__,_| |_| |_| |_| | .__/ |_| \___| hackDir /Users/gregor/.grgd/hack |
|_| |
example [global options] command [command options] [arguments...]
COMMANDS:
/// group-1 \\\
my-commands-group-1 -> do some stuff
/// settings \\\
update -> Check and load updates
profile -> Configuration for profiles
project -> Configuration for projects
service -> Configuration for services
Flags:
--profile value, -p value (default: "gregor") [$USER]
--log-level value (default: "info")
--version, -v print the version (default: false)
grgd uses an extendable persistence backend to configure your profiles, projects and services. Per default a sqlite DB is used and safed at ~/.grgd/
To start your own implementation define which dependecies you want to rewrite and which you want to reuse:
func main() {
log := logger.ProvideLogrusLogger()
dependecies := map[string]interface{}{
"ILogger": logger.ProvideLogrusLogger,
"IConfig": config.ProvideConfig,
"IHelper": helper.ProvideHelper,
"INetworker": helper.ProvideNetworker,
"IDAL": gormdal.ProvideDAL,
"IProfile": profile.ProvideProfile,
"IUIPlugin": view.ProvideFallbackUI,
"my-commands": ProvideCommands,
}
core, err := core.RegisterDependecies(dependecies)
if err != nil {
log.Fatalf("Error with register dependencies: %s", err.Error())
}
grgd.NewApp(core, "example", "0.0.1", nil)
}
Feel free to add any function pointers to the list of dependencies. In this example the key my-commands
is added with the value of pointer to function that returns customized commands.
"my-commands": ProvideCommands,
Run go build:
go build -o myapp *.go
"If you'd like to contribute, please fork the repository and use a feature branch. Pull requests are warmly welcome."
- Repository: https://github.com/gregod-com/grgd
- Issue tracker: https://github.com/gregod-com/grgd/issues
- Related projects:
- urfave cli: https://github.com/urfave/cli
"The code in this project is licensed under MIT license."