{"id":18709463,"url":"https://github.com/joemiller/taskhammer","last_synced_at":"2025-04-12T10:35:28.958Z","repository":{"id":138236963,"uuid":"202954057","full_name":"joemiller/taskhammer","owner":"joemiller","description":"Hammerspoon module (\"Spoon\") for running scripts from the macOS menu bar","archived":false,"fork":false,"pushed_at":"2020-07-02T15:56:43.000Z","size":418,"stargazers_count":10,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-10T07:55:59.382Z","etag":null,"topics":["hammerspoon","lua","macos","spoon","spoons"],"latest_commit_sha":null,"homepage":"","language":"Lua","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/joemiller.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-08-18T03:10:12.000Z","updated_at":"2025-02-18T00:47:38.000Z","dependencies_parsed_at":null,"dependency_job_id":"d253766e-b642-41e5-87f5-df07c851810b","html_url":"https://github.com/joemiller/taskhammer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joemiller%2Ftaskhammer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joemiller%2Ftaskhammer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joemiller%2Ftaskhammer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joemiller%2Ftaskhammer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joemiller","download_url":"https://codeload.github.com/joemiller/taskhammer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248553982,"owners_count":21123558,"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":["hammerspoon","lua","macos","spoon","spoons"],"created_at":"2024-11-07T12:27:39.162Z","updated_at":"2025-04-12T10:35:28.951Z","avatar_url":"https://github.com/joemiller.png","language":"Lua","readme":"TaskHammer.spoon\n================\n\n[![CircleCI](https://circleci.com/gh/joemiller/taskhammer.svg?style=svg)](https://circleci.com/gh/joemiller/taskhammer)\n\n[Hammerspoon](https://www.hammerspoon.org) Spoon for running scripts in the macOS menu bar\n\n![screenshot](./screenshot.png)\n\nInstall\n-------\n\nInstall [Hammerspoon](https://www.hammerspoon.org)\n\n**Recommended**: If you're using the `SpoonInstall` spoon, add to `~/.hammerspoon/init.lua`:\n\n```lua\nhs.loadSpoon(\"SpoonInstall\")\nInstall = spoon.SpoonInstall\n\n-- Register the repository\nInstall.repos[\"TaskHammer\"] = {\n  desc = \"TaskHammer.spoon repository\",\n  url = \"https://github.com/joemiller/taskhammer\"\n}\n\n-- Download, load, configure and start:\nInstall:andUse(\"TaskHammer\",\n    {\n        repo = \"TaskHammer\",\n        start = true,\n        config = {\n            tasks = { ... } -- configure tasks here. See below for details.\n        }\n    }\n)\n```\n\n**Alternative**:\n\n* download [TaskHammer.spoon.zip](https://github.com/joemiller/taskhammer/raw/master/Spoons/TaskHammer.spoon.zip) and extract.\n* Double-click or open `TaskHammer.spoon` and Hammerspoon will install it.\n  * Or, manually move `TaskHammer.spoon` to `~/.hammerspoon/Spoons/`\n* Load, configure, and start the plugin:\n\n```lua\nhs.loadSpoon('TaskHammer')        -- initialize the plugin\nspoon.TaskHammer.tasks = {...}    -- configure tasks here. See below for details.\nspoon.TaskHammer:start()          -- start the Menu Bar application\n```\n\nConfigure\n---------\n\nConfiguration is expressed through the Spoon's `tasks` table. Each task is itself a table with the following keys:\n\n* `name` - Required. A name for the task to be displayed in the menu bar dropdown list.\n* `cmd` - Required. Path to executable or script to run.\n* `args` - If given, a table in array format containing arguments to pass to `cmd`\n* `env` - If given, a table in key=value format containing environment variables to be added to the cmd's execution environment. By default environment variables are inherited from Hammerspoon. Variables specified here are *added* to this set.\n* `prompts` - If given, a table containing one or more prompts to display to the user. Inputs from these prompts are added to the environment before executing the cmd. Each prompt is itself a table with the following keys:\n  * `envvar` - Required. The name of the environment variable to store the input into.\n  * `description` - A friendly message to display to the user describing the expected input value.\n\nExamples:\n\n ```lua\nInstall:andUse(\n    \"TaskHammer\",\n    {\n        repo = \"TaskHammer\",\n        start = true,\n        -- loglevel = \"debug\", -- enable debug logging\n        config = {\n            tasks = {\n                { -- Basic example\n                    name = \"simple task\",\n                    cmd = \"/path/to/script.sh\",\n                },\n                { -- Pass arguments to the cmd, eg: `/path/to/script.sh foo bar`\n                    name = \"task with arguments\",\n                    cmd = \"/path/to/script.sh\",\n                    args = {\"foo\", \"bar\"},\n                },\n                { -- Add environment vars\n                    name = \"task with extra env vars\",\n                    cmd = \"/path/to/script.sh\",\n                    env = {\n                        FOO = \"BAR\",\n                        BAZ = \"blah\"\n                    }\n                },\n                { -- Prompt the user for input which will be available to the task via environment vars\n                    name = \"test prompt\",\n                    cmd = \"/usr/bin/env\",\n                    prompts = {\n                        {\n                            envvar = \"FOOBAR\",\n                            description = \"1password pass\"\n                        },\n                        {\n                            envvar = \"ANOTHER_ONE\",\n                            description = \"another input\"\n                        }\n                    }\n                },\n                { -- A real exmaple of how I run restic backups over sftp\n                    name = \"Restic Backup\",\n                    cmd = \"/Users/joe/backup-scripts/backup.sh\",\n                    env = {\n                        SSH_AUTH_SOCK = \"/Users/joe/.gnupg/S.gpg-agent.ssh\"\n                    },\n                    prompts = {\n                        {\n                            envvar = \"RESTIC_PASSWORD\",\n                            description = \"Please enter the Restic repository password\"\n                        }\n                    }\n                }\n            }\n        }\n    }\n)\n```\n\nTODO\n----\n\n- [ ] implement real-time task output updating. Try again after this is fixed: https://github.com/Hammerspoon/hammerspoon/issues/1782\n- [ ] refactor!! I don't write lua/hammerspoon often. Current code is basically a single giant function. This could be improved with an eye toward testability\n- [ ] unit tests (eg: https://github.com/andweeb/ki/tree/master/spec)\n- [ ] optionally launch tasks via hot-keys\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoemiller%2Ftaskhammer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoemiller%2Ftaskhammer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoemiller%2Ftaskhammer/lists"}