{"id":13567469,"url":"https://github.com/sharkdp/trigger","last_synced_at":"2025-04-10T18:05:32.091Z","repository":{"id":65984784,"uuid":"62752649","full_name":"sharkdp/trigger","owner":"sharkdp","description":"Run a user-defined command on file changes","archived":false,"fork":false,"pushed_at":"2020-03-29T19:52:27.000Z","size":12,"stargazers_count":187,"open_issues_count":1,"forks_count":9,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-24T15:47:27.583Z","etag":null,"topics":["inotify","shell"],"latest_commit_sha":null,"homepage":null,"language":"Shell","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/sharkdp.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":"2016-07-06T20:54:39.000Z","updated_at":"2025-03-20T16:32:29.000Z","dependencies_parsed_at":"2023-02-19T19:01:14.462Z","dependency_job_id":null,"html_url":"https://github.com/sharkdp/trigger","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/sharkdp%2Ftrigger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharkdp%2Ftrigger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharkdp%2Ftrigger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharkdp%2Ftrigger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sharkdp","download_url":"https://codeload.github.com/sharkdp/trigger/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248265993,"owners_count":21075076,"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":["inotify","shell"],"created_at":"2024-08-01T13:02:32.238Z","updated_at":"2025-04-10T18:05:32.068Z","avatar_url":"https://github.com/sharkdp.png","language":"Shell","funding_links":[],"categories":["Shell"],"sub_categories":[],"readme":"# trigger\n\n``` bash\nUsage: trigger COMMAND [FILE...]\n```\n\ntrigger runs the given *COMMAND* every time one of the *FILE*s is changed.\nIf no *FILE* argument is given, trigger watches everything in the current\ndirectory, recursively.\n\nIn the *COMMAND* string, `#1`, `#2`, .. can be used as synonyms for the\n*FILE*names. The helper `tg COMMAND FILE ...` is a shortcut for\n`trigger 'COMMAND #1' FILE ...`.\n\n![Example usage](http://i.imgur.com/xlpR376.gif)\n\n## Examples\n\n### Make\n\nRun `make` every time one of the files in the current directory changes:\n\n```\ntrigger make\n```\n\n### Python\n\nRun `python main.py` every time either `main.py` or `config.py` changes:\n\n``` bash\ntrigger 'python #1' main.py config.py\n```\n\nBy using the `tg` helper command, this can be shortened to:\n\n``` bash\ntg python main.py config.py\n```\n\n### Markdown to PDF\n\nConvert a Markdown document to PDF every time it is changed. Combine this with\nan auto-reloading PDF-viewer (e.g. okular) to get a live preview:\n\n``` bash\ntg 'pandoc -t latex -o README.pdf' README.md\n```\n\n### Less to CSS\n\nConvert a LESS file to CSS:\n\n``` bash\ntrigger 'lessc #1 \u003e main.css' main.less\n```\n\n### Interrupt mode\n\nIf `trigger` is called with the `-i` (or `--interrupt`) option, it will kill\nrunning subprocesses whenever a file changes:\n``` bash\ntrigger -i longRunningCommand input.dat\n```\n\n\n## Requirements\n\ntrigger is just a simple wrapper around `inotifywait`. It should be available\nfor most Linux distributions (the package is typically called `inotify-tools`).\n\n\n## Installation\n\nKeeping in mind that, in principle, you should not copy-and-paste into your\nshell, something like this should work:\n\n``` bash\ngit clone https://github.com/sharkdp/trigger ~/.trigger\n\necho 'export PATH=\"$PATH:$HOME/.trigger\"' \u003e\u003e .bashrc\n```\n\n## Related projects\n\nAlso have a look at these projects, to see if they fit your needs better:\n\n- [http://entrproject.org/](http://entrproject.org/) - more features, slightly more complicated syntax\n- [https://github.com/joh/when-changed](https://github.com/joh/when-changed) - different syntax, requires python and watchdog\n- [https://facebook.github.io/watchman/](https://facebook.github.io/watchman/) - much more powerful but more complicated syntax.\n- [http://inotify.aiken.cz/?section=incron\u0026page=about](http://inotify.aiken.cz/?section=incron\u0026page=about) - more difficult to setup up\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsharkdp%2Ftrigger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsharkdp%2Ftrigger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsharkdp%2Ftrigger/lists"}