grgd

package module
v0.16.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 25, 2022 License: MIT Imports: 8 Imported by: 0

README

main pipeline GitHub go.mod Go version of a Go module GoReportCard GitHub license

grgd

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.

Getting started

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)

Initial Configuration

grgd uses an extendable persistence backend to configure your profiles, projects and services. Per default a sqlite DB is used and safed at ~/.grgd/

Developing

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,
Building

Run go build:

go build -o myapp *.go

Features

Configuration

Contributing

"If you'd like to contribute, please fork the repository and use a feature branch. Pull requests are warmly welcome."

Licensing

"The code in this project is licensed under MIT license."

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewApp

func NewApp(core interfaces.ICore, name string, version string, hooks map[string]func(*cli.Context) error)

Types

This section is empty.

Directories

Path Synopsis
cmd
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
pkg
Provides basic bulding blocks for advanced console UI
Provides basic bulding blocks for advanced console UI

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL