{"id":16056575,"url":"https://github.com/markbates/jim","last_synced_at":"2025-07-04T23:08:43.349Z","repository":{"id":57501827,"uuid":"221495898","full_name":"markbates/jim","owner":"markbates","description":null,"archived":false,"fork":false,"pushed_at":"2020-01-06T21:15:50.000Z","size":45,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-07T14:39:32.052Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/markbates.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"markbates","patreon":"buffalo"}},"created_at":"2019-11-13T15:50:07.000Z","updated_at":"2020-01-06T21:15:41.000Z","dependencies_parsed_at":"2022-09-19T09:11:17.077Z","dependency_job_id":null,"html_url":"https://github.com/markbates/jim","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/markbates/jim","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markbates%2Fjim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markbates%2Fjim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markbates%2Fjim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markbates%2Fjim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/markbates","download_url":"https://codeload.github.com/markbates/jim/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markbates%2Fjim/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263632057,"owners_count":23491530,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-10-09T03:00:26.299Z","updated_at":"2025-07-04T23:08:43.330Z","avatar_url":"https://github.com/markbates.png","language":"Go","funding_links":["https://github.com/sponsors/markbates","https://patreon.com/buffalo"],"categories":[],"sub_categories":[],"readme":"# Jim\n\nJim is a task runner, similiar to [https://github.com/markbates/grift](https://github.com/markbates/grift).\n\n### Requirements\n\n* Go 1.13+\n* Modules\n\n## Installation\n\n```bash\n$ go get github.com/markbates/jim/cmd/jim\n```\n\n---\n\n## Usage\n\nTo create a new task that you can run with jim. You need to create a package level function with the following API in your module:\n\n```go\nfunc \u003cname\u003e(ctx context.Context, args []string) error {\n\treturn nil\n}\n```\n\nYou can place these functions anywhere in your application in any package. You don't need to follow any naming conventions or use any special build tags. Your function need only take a [`context#Context`](https://godoc.org/context#Context) and a slice of `string`, and return an error.\n\n\nSee the [./examples/ref](./examples/ref) application for the full code.\n\n```text\n.\n├── db\n│   ├── seed\n│   │   └── users.go\n│   └── seed.go\n├── go.mod\n├── go.sum\n├── ref.go\n└── task\n    └── task.go\n\n3 directories, 6 files\n```\n\nThe `go.mod` file:\n\n```go\nmodule ref\n\ngo 1.13\n```\n\nExample task `ref/db/seed/users.go`\n\n```go\npackage seed\n\nimport (\n\t\"context\"\n\t\"fmt\"\n)\n\n// Users puts all of the users into all of the databases\nfunc Users(ctx context.Context, args []string) error {\n\tfmt.Println(\"loading users\", args)\n\treturn nil\n}\n```\n\n### Running a Task via CLI\n\nTo run the above mentioned task we can use the `jim` command:\n\n```bash\n$ jim db/seed.Users 1 2 3 4\n\nloading users [1 2 3 4]\n```\n\nLet's break down the `db/seed.Users` bit, shall we? The last part, `Users` is the name of the function that will be run. This **MUST** match capitalization.\n\nThe `db/seed` part is converted to the package `\u003cmodule path\u003e/db/seed` which, hopefully, contains a `Users` function that matches the correct API.\n\n### Running a Task via API\n\nTo run your task via the API in your application, give it a `context.Context`, some arguments, and you're good to go. :)\n\n### Getting Task Help\n\nThe `jim -h` flag, followed by the task will print the GoDoc for that function.\n\n```bash\n$ jim -h db/seed.Users\n\npackage seed // import \"ref/db/seed\"\n\nfunc Users(ctx context.Context, args []string) error\n    Users puts all of the users into all of the databases\n```\n\n## Listing Available Tasks\n\n```bash\n$ jim list\n\nref/db/seed.Users\nref/db.Seed\nref/task.Another\nref/task.Something\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkbates%2Fjim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarkbates%2Fjim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkbates%2Fjim/lists"}