{"id":22870340,"url":"https://github.com/berquerant/grdep","last_synced_at":"2025-03-31T11:26:16.541Z","repository":{"id":231790873,"uuid":"782744297","full_name":"berquerant/grdep","owner":"berquerant","description":"Find dependencies by grep","archived":false,"fork":false,"pushed_at":"2024-05-21T12:05:38.000Z","size":130,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-05-21T13:29:26.753Z","etag":null,"topics":["go"],"latest_commit_sha":null,"homepage":"","language":"Go","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/berquerant.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":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-04-05T23:40:19.000Z","updated_at":"2024-05-21T13:29:30.275Z","dependencies_parsed_at":"2024-05-21T13:29:27.393Z","dependency_job_id":null,"html_url":"https://github.com/berquerant/grdep","commit_stats":null,"previous_names":["berquerant/grdep"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berquerant%2Fgrdep","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berquerant%2Fgrdep/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berquerant%2Fgrdep/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berquerant%2Fgrdep/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/berquerant","download_url":"https://codeload.github.com/berquerant/grdep/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246460348,"owners_count":20781101,"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":["go"],"created_at":"2024-12-13T13:14:35.531Z","updated_at":"2025-03-31T11:26:16.518Z","avatar_url":"https://github.com/berquerant.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# grdep\n\n```\n❯ grdep -h\nFind dependencies by grep.\n\nUsage:\n  grdep [command]\n\nAvailable Commands:\n  completion  Generate the autocompletion script for the specified shell\n  configcheck Test configurations\n  help        Help about any command\n  re          Test regexp\n  run         Find dependencies\n  skeleton    Generate config skeleton\n\nFlags:\n      --debug     Enable debug logs\n  -h, --help      help for grdep\n      --metrics   Show metrics\n\nUse \"grdep [command] --help\" for more information about a command.\n```\n\n## Usage\n\n```\n❯ grdep skeleton | tee skeleton.yml\n---\n# Find matching dependencies in the following order:\n#\n# 1. Ignore directories and files according to 'ignore'.\n# 2. Determine the file's category according to 'category'.\n# 3. Normalize categories according to 'normalizer.category'.\n# 4. Find nodes (dependencies) according to 'node'.\n# 5. Normalize nodes according to 'normalizer.node'.\n#\n# The following can be written in matchers:\n#\n# 'r' holds a regexp.\n# If a line matches, then pass it to the next.\n#\n#   matcher:\n#     - r: \"REGEXP\"\n#\n# 'tmpl' holds a template.\n# If a line mathes, then replace variables in the 'tmpl' and pass it to the next.\n#\n#   matcher:\n#     - r: \"REGEXP\"\n#       tmpl: \"TEMPLATE\"\n#\n# 'val' holds constants.\n# Pass the constants to the next.\n#\n#   matcher:\n#     - val:\n#         - \"VALUE1\"\n#         - \"VALUE2\"\n#\n# If a line matches, then pass the constants to the next.\n#\n#   matcher:\n#     - r: \"REGEXP\"\n#     - val:\n#         - \"VALUE1\"\n#         - \"VALUE2\"\n#\n# 'not' holds a regexp.\n# If a line does not match, then pass it to the next.\n#\n#   matcher:\n#     - not: \"REGEXP\"\n#\n# If a line does not match, then pass the constants to the next.\n#\n#   matcher:\n#     - not: \"REGEXP\"\n#     - val:\n#         - \"VALUE1\"\n#         - \"VALUE2\"\n#\n# 'sh' holds a script.\n# Invoke the shell script (bash).\n# If the script is successful and outputs something other than whitespaces from stdout,\n# pass it to the next.\n#\n#   matcher:\n#     - sh: \"BASH\"\n#\n# 'g' holds a glob.\n# If a line matches, then pass it to the next.\n#\n#   matcher:\n#     - g: \"GLOB\"\n#\n# 'lua' holds a lua script.\n# 'lua_call' holds an entrypoint.\n# LUA_SCRIPT should contain a function named LUA_ENTRYPOINT.\n# The function should takes a string as an argument and returns a string.\n# If the script is successful and returns something other than whitespaces, pass it to the next.\n#\n#   matcher:\n#     - lua: LUA_SCRIPT\n#       lua_call: \"LUA_ENTRYPOINT\"\n#\n# 'lua_file' holds a lua script file.\n#\n#   matcher:\n#     - lua_file: \"LUA_SCRIPT_FILE\"\n#       lua_call: \"LUA_ENTRYPOINT\"\n#\n#\n# List of matchers for files and directories to ignore.\nignore:\n  - r: \"ignore\"\n# Determine file categories from filename or text.\ncategory:\n  - name: if filename matches then the categories are bash and sh\n    filename:\n      # matchers can be wrtten here\n      - r: \"\\\\.sh$\"\n      - val:\n          - \"bash\"\n          - \"sh\"\n  - filename: # 'name' is optional\n      # extract extension as category\n      - r: \"\\\\.(?P\u003cext\u003e\\\\w+)$\"\n        tmpl: \"$ext\"\n  - name: if file content matches then the category is bash\n    text:\n      # matchers can be wrtten here\n      - r: \"#!/bin/bash\"\n      - val:\n          - \"bash\"\n# Find dependencies.\nnode:\n  - name: create bash node\n    category: \"bash\"\n    matcher:\n      - r: \"^\\\\. (?P\u003cv\u003e.+)$\"\n        tmpl: \"$v\"\n  - name: create bin node\n    category: \".*\"\n    matcher:\n      - r: \"^/usr/bin/\"\n  - name: local/src but not /usr/local/src\n    category: \"bash\"\n    matcher:\n      - not: \"/usr/local/src\"\n      - r: \"local/src\"\n  - name: install\n    category: \"bash\"\n    matcher:\n      - r: \"^install (?P\u003cv\u003e.+)$\"\n        tmpl: \"$v\"\n      - sh: \"tr ' ' '\\n'\"\n  - name: docker from\n    category: \"dockerfile\"\n    matcher:\n      - g: \"FROM*\"\n  - name: docker entrypoint\n    category: \"dockerfile\"\n    matcher:\n      - g: \"ENTRY*\"\n      - sh: \"cut -d '[' -f 2\"\n      - sh: \"cut -d ']' -f 1\"\n      - lua: |\n          function up(src)\n            return string.upper(string.gsub(src, \"\\\"\", \"\"))\n          end\n        lua_call: up\n# Normalize categories and nodes.\n# If there is no match, the value remains as is.\nnormalizer:\n  category:\n    - name: sh to bash\n      matcher:\n        - r: \"^sh$\"\n        - val:\n            - bash\n  node:\n    - name: extract binary name\n      matcher:\n        - r: \"/usr/bin/(?P\u003cv\u003e\\\\w+)\"\n          tmpl: \"$v\"\n\n❯ echo 'some/path' | grdep run skeleton.yml\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fberquerant%2Fgrdep","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fberquerant%2Fgrdep","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fberquerant%2Fgrdep/lists"}