{"id":19380469,"url":"https://github.com/margostino/griffin","last_synced_at":"2026-05-03T11:33:21.146Z","repository":{"id":57633671,"uuid":"415365198","full_name":"margostino/griffin","owner":"margostino","description":"Shell generator built on top of GO Prompt (a library for building powerful interactive prompts) to bind commands and actions dynamically and focus on the action handler.","archived":false,"fork":false,"pushed_at":"2022-11-30T18:14:54.000Z","size":55,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-24T16:52:03.288Z","etag":null,"topics":["cli","command-line","shell","terminal"],"latest_commit_sha":null,"homepage":"https://margostino.com/","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/margostino.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-10-09T16:39:42.000Z","updated_at":"2021-10-23T16:32:46.000Z","dependencies_parsed_at":"2023-01-23T15:46:22.566Z","dependency_job_id":null,"html_url":"https://github.com/margostino/griffin","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/margostino/griffin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/margostino%2Fgriffin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/margostino%2Fgriffin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/margostino%2Fgriffin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/margostino%2Fgriffin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/margostino","download_url":"https://codeload.github.com/margostino/griffin/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/margostino%2Fgriffin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32567372,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T06:36:36.687Z","status":"ssl_error","status_checked_at":"2026-05-03T06:36:09.306Z","response_time":103,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","command-line","shell","terminal"],"created_at":"2024-11-10T09:13:59.184Z","updated_at":"2026-05-03T11:33:21.113Z","avatar_url":"https://github.com/margostino.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Griffin\n\n[![Go Report Card](https://goreportcard.com/badge/github.com/margostino/griffin)](https://goreportcard.com/report/github.com/margostino/griffin)\n![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)\n[![GoDoc](https://godoc.org/github.com/margostino/griffin?status.svg)](https://godoc.org/github.com/margostino/griffin)\n![tests](https://github.com/margostino/griffin/workflows/tests/badge.svg)\n\nShell generator built on top of [GO Prompt](https://github.com/c-bata/go-prompt) (a library for building powerful\ninteractive prompts). Griffin allows to bind command and actions by configuration in order to reduce boilerplate code\nand let developer focus on the action handling.\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/margostino/griffin/pkg/griffin\"\n)\n\nvar Actions = map[string]func(){\n\t\"ExecuteDoSomething\": ExecuteDoSomething,\n}\n\nvar InputActions = map[string]func([]string){\n\t\"ExecuteDoSomethingWithInput\": ExecuteDoSomethingWithInput,\n}\n\nfunc ExecuteDoSomething() {\n\tfmt.Println(\"do something\")\n}\n\nfunc ExecuteSelectSomething(args []string) {\n\tfmt.Println(\"select something %s\", args[0])\n}\n\nfunc main() {\n\tpowershell := griffin.New().\n\t\tSetActions(Actions).\n\t\tSetActionsStrings(InputActions).\n\t\tLoadConfiguration(\"commands.yml\")\n\tpowershell.Start()\n}\n```\n\n### Configuration\n\nExample:\n\n```yaml\ncommands:\n  - id: select something\n    description: \"Select something amazing\"\n    action: ExecuteDoSomething\n  - id: select input\n    args: 1\n    description: \"Select input\"\n    pattern: \"^select something [a-z-A-Z]+$\"\n    action: ExecuteSelectSomething\n```\n\n### Commands\n\nA shell can be created with Actions and Commands. A command might be: `run job`.\n\n### Actions\n\nAn action is a function name without params: `ExecuteSomething()` or a function name with string\nparams: `ExecuteSomething(name string)`. Currently, only string params are supported.\n\n### Configuration\n\nConfiguration might be loaded by YML file (see [example](./example/config/commands.yml)) or sending a list\nof `CommandConfiguration`:\n\n```go\ntype CommandConfiguration struct {\nId          string `yaml:\"id\"`\nDescription string `yaml:\"description\"`\nArgs        int    `yaml:\"args\"`\nAction      string `yaml:\"action\"`\nPattern     string `yaml:\"pattern\"`\n}\n```\n\n`ID`: the command keys to trigger an action.  \nExample: `run job`, `help`, `show users`\n\n`Description`: short description of the command and action. This will be visible in as prompt suggestion.\n\n`Args`: amount of parameters that the action needs to be executed. Default `0`\n\n`Action`: name of the function handler to serve the command ID.\n\n`Pattern`: if `Args \u003e 1` a regex pattern is used to match the command with action.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmargostino%2Fgriffin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmargostino%2Fgriffin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmargostino%2Fgriffin/lists"}