{"id":13451799,"url":"https://github.com/mateodelnorte/loop","last_synced_at":"2025-04-05T23:05:58.278Z","repository":{"id":14072471,"uuid":"75898709","full_name":"mateodelnorte/loop","owner":"mateodelnorte","description":"loop through commands in fun and amazing ways!","archived":false,"fork":false,"pushed_at":"2024-03-26T18:41:47.000Z","size":363,"stargazers_count":124,"open_issues_count":11,"forks_count":12,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-04-13T16:33:20.712Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mateodelnorte.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":"support/.looprc","governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2016-12-08T03:18:50.000Z","updated_at":"2024-04-23T05:28:47.155Z","dependencies_parsed_at":"2023-01-13T17:46:59.271Z","dependency_job_id":"852a8cb9-e2a4-48c7-bfee-52074f9d7cfa","html_url":"https://github.com/mateodelnorte/loop","commit_stats":{"total_commits":120,"total_committers":11,"mean_commits":"10.909090909090908","dds":0.625,"last_synced_commit":"54e57ca51faff6ff286b099f5d56f9c2f6be229d"},"previous_names":["mateodelnorte/loop-things"],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mateodelnorte%2Floop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mateodelnorte%2Floop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mateodelnorte%2Floop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mateodelnorte%2Floop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mateodelnorte","download_url":"https://codeload.github.com/mateodelnorte/loop/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247411228,"owners_count":20934653,"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-07-31T07:01:02.939Z","updated_at":"2025-04-05T23:05:58.247Z","avatar_url":"https://github.com/mateodelnorte.png","language":"JavaScript","funding_links":[],"categories":["others","JavaScript"],"sub_categories":[],"readme":"# loop\n[![Build Status](https://travis-ci.com/mateodelnorte/loop.svg?branch=master)](https://travis-ci.com/mateodelnorte/loop)\n\nloop expands commands to work simultaneously against any number of subdirectories in your current working path. Want to perform a `git status` on 15 projects at once? With loop, you can do it!\n\n```\n    loop executes a command against child directories within its current working directory\n\n    usage:\n\n      loop [command]                                      - execute a command against all child dirs\n      loop [\"command with multiple words in quotes\"]      - execute a multi-word command against all child dirs\n      loop --cwd ../other/working/directory               - execute a command against all child dirs, setting the working directory to another directory\n      loop --include comma,delimited,list,of,dirs         - execute a command against all child dirs including a number of directories which might otherwise be ignored, for instance, in .looprc\n      loop --include-only comma,delimited,list,of,dirs    - execute a command against all child dirs, ignoring .looprc, and only including the specified directories\n      loop --include-pattern 'regexp'                     - execute a command against all child dirs that match the regular expression\n      loop --exclude comma,delimited,list,of,dirs         - execute a command against all child dirs, excluding the specified directories\n      loop --exclude-only comma,delimited,list,of,dirs    - execute a command against all child dirs, excluding only the specified directories\n      loop --exclude-pattern 'regexp'                     - execute a command against all child dirs, excluding directories that match the regular expression\n      loop --init                                         - creates a .looprc in the current working directory\n\n    examples:\n\n      loop pwd\n      loop \"git status\"\n      loop \"git checkout -b feature/new-feature\"\n      loop \"git push origin feature/new-feature\"\n\n    .looprc:\n\n      directories containing a .looprc json file may have extra behavior, determined by properties within the file:\n\n        ignore (type Array) any child directory names listed in ignore will be ignored and skipped from execution\n\n    example .looprc:\n\n    {\n      \"ignore\": [ \".git\", \".vagrant\", \".vscode\", \"ansible\", \"node_modules\", \"scripts\" ]\n    }\n```\n\n## Installation\n\n`npm install -g loop`\n\n## Basic Usage\n\nloop installs a `loop` command which you can leverage from the command line, in your package.json scripts, etc. The syntax is super simple. Just `loop [your command]`. If the command you wish to run consists of multiple words, place the command in quotes: `loop \"your --you | really -R | long -o | command\"`. \n\nIn a folder with the following structure: \n```\n./git\n./bin\n./lib\n./node_modules\n./test\n./index.js\n./package.json\n```\n\nexecuting `loop pwd` yields the following results: \n```\n➜  nycnode-site git:(master) loop pwd\n\n.git\n/Users/mateodelnorte/development/nycnode/nycnode-site/.git\n\nlib\n/Users/mateodelnorte/development/nycnode/nycnode-site/lib\n\nnode_modules\n/Users/mateodelnorte/development/nycnode/nycnode-site/node_modules\n\ntest\n/Users/mateodelnorte/development/nycnode/nycnode-site/test\n```\n\n## .looprc\n\nloop can use a `.looprc` file to customize how loop behaves in a particular folder. Installing a `.looprc` file to a folder is simple: \n\n`loop --init` results in the following file being created: \n\n```\n{\n  \"ignore\": [ \".git\", \".vagrant\", \".vscode\", \"node_modules\" ]\n}\n```\n\nNow, when we perform the same command we did previously `loop pwd`, `loop` will recognize the `.looprc` file and see the `.git` folder is ignored - excluding it from the results: \n```\n➜  nycnode-site git:(master) loop pwd\n\nlib\n/Users/mateodelnorte/development/nycnode/nycnode-site/lib\n\nnode_modules\n/Users/mateodelnorte/development/nycnode/nycnode-site/node_modules\n\ntest\n/Users/mateodelnorte/development/nycnode/nycnode-site/test\n```\n\n## On to the Fun Stuff\n\nNeat, so now we can ignore folders that we don't work with directly. Imagine having a folder that contains all your project repositories for work. Wish you could find out how many files are in each? \n```\n➜  nycnode git:(master) ✗ loop \"find . -path ./node_modules -prune -o -type f  | wc -l\"\n\nnycnode-denormalizer\n125\n\nnycnode-meetup-ingestor\n148\n\nnycnode-site\n1106\n\nnycnode-user-ingestor\n103\n\nnycnode-youtube-ingestor\n81\n```\n\nBetter yet, what if you're starting a new feature that spans a distributed system composed of many microservices and a site or two? \n\n```\n➜  nycnode git:(master) ✗ loop \"git checkout master\"\n\nnycnode-denormalizer\nAlready on 'master'\n\nnycnode-meetup-ingestor\nAlready on 'master'\n\nnycnode-site\nAlready on 'master'\n\nnycnode-user-ingestor\nAlready on 'master'\n\nnycnode-youtube-ingestor\nAlready on 'master'\n\n➜  nycnode git:(master) ✗ loop \"git pull origin master\"\n\nnycnode-denormalizer\nFrom github.com:mateodelnorte/nycnode-denormalizer\n * branch            master     -\u003e FETCH_HEAD\n\nnycnode-meetup-ingestor\nFrom github.com:mateodelnorte/nycnode-meetup-ingestor\n * branch            master     -\u003e FETCH_HEAD\n\nnycnode-site\nFrom github.com:mateodelnorte/nycnode-site\n * branch            master     -\u003e FETCH_HEAD\n\nnycnode-user-ingestor\nFrom github.com:mateodelnorte/nycnode-user-ingestor\n * branch            master     -\u003e FETCH_HEAD\n\nnycnode-youtube-ingestor\nFrom github.com:mateodelnorte/nycnode-youtube-ingestor\n * branch            master     -\u003e FETCH_HEAD\n \n➜  nycnode git:(master) ✗ loop \"git checkout -b feature/my-new-feature\"\n\nnycnode-denormalizer\nSwitched to a new branch 'feature/my-new-feature'\n\nnycnode-meetup-ingestor\nSwitched to a new branch 'feature/my-new-feature'\n\nnycnode-site\nSwitched to a new branch 'feature/my-new-feature'\n\nnycnode-user-ingestor\nSwitched to a new branch 'feature/my-new-feature'\n\nnycnode-youtube-ingestor\nSwitched to a new branch 'feature/my-new-feature'\n```\n\nNow you're ready to code away across your whole system! `loop \"git status\"` will show you your status across all repos. `loop \"git diff\"`, `loop \"git push origin feature/my-new-feature\"`, and other commands all work like you'd think!\n\n## TODO: \n- plugins\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmateodelnorte%2Floop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmateodelnorte%2Floop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmateodelnorte%2Floop/lists"}