{"id":31629665,"url":"https://github.com/gregros/packe","last_synced_at":"2025-10-26T10:24:16.309Z","repository":{"id":277749695,"uuid":"933360943","full_name":"GregRos/packe","owner":"GregRos","description":"The Python-based Bash script runner I use.","archived":false,"fork":false,"pushed_at":"2025-09-29T12:04:59.000Z","size":62,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-29T12:36:06.119Z","etag":null,"topics":["bash","linux","personal","poetry","python","scripting","tool"],"latest_commit_sha":null,"homepage":"","language":"Python","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/GregRos.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-02-15T19:12:31.000Z","updated_at":"2025-09-29T12:05:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"9ee5861b-132a-4101-adeb-7c3aa83666e0","html_url":"https://github.com/GregRos/packe","commit_stats":null,"previous_names":["gregros/pyrun","gregros/packe"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/GregRos/packe","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GregRos%2Fpacke","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GregRos%2Fpacke/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GregRos%2Fpacke/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GregRos%2Fpacke/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GregRos","download_url":"https://codeload.github.com/GregRos/packe/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GregRos%2Fpacke/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278685655,"owners_count":26028322,"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","status":"online","status_checked_at":"2025-10-06T02:00:05.630Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["bash","linux","personal","poetry","python","scripting","tool"],"created_at":"2025-10-06T21:32:37.823Z","updated_at":"2025-10-06T21:32:40.667Z","avatar_url":"https://github.com/GregRos.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# packe\n\npacke is a script runner for executing configuration scripts in bulk. Supports flexible script selection and hierachical structure.\n\n## Features\n\n- Execute indexed bash scripts in order.\n- Script output prefixed with identifier.\n- Organize scripts into indexed packs (folders).\n- Use prerun scripts to conditionally run packs.\n- Use a config file to define script roots.\n- Flexible script selection using run selectors with ranges and wildcards.\n- Extra bash commands for colored output in scripts.\n\n## Script\n\nA packe script is a bash file that is executed by packe. packe script files must end with `.bash` or `.sh`. They also need to be indexed, kind of like `conf.d` files.\n\nYou can index scripts using `-` or `.` as separators. Scripts are normally indexed using numbers, but you can also use underscores. Underscored scripts can only be executed explicitly by name.\n\nHere are some examples of valid script filenames:\n\n```\n01-setup.bash\n02.install.bash\n_.do-stuff.bash\n_-do-more-stuff.sh\n```\n\nFiles that aren't indexed using numbers or underscores aren't considered executable by packe.\n\n### Script pack\n\nA _script pack_ is an indexed folder that contains more indexed scripts or packs. Script packs are indexed using numbers or underscores, just like scripts.\n\nHere is an example folder structure with several script packs:\n\n```\nroot/\n    1.first/\n        001.setup.bash\n        002.install.bash\n    2.second/\n        01.setup.bash\n        02.install.bash\n```\n\nWhen a script pack is executed, all its _numbered_ contents are executed recursively in lexicographic order. This doesn’t include `_` scripts or packs.\n\nPacks let you organize scripts into groups. For example, you can have a pack for setting up a database, and another for setting up a web server.\n\nFolders that aren't indexed using numbers or underscores aren't considered executable by packe.\n\n### Root\n\nA _root_ is a special script pack that is defined in the config file. A root can contain other packs or scripts. It doesn't have any naming requirements.\n\n### Run selector\n\nA _run selector_ is a glob-like path that determines which scripts to run. It can include ranges and wildcards.\n\nRun selectors are made of path segments separated by `/`. Each segment can be one or more references to a script or pack. There are several ways to reference scripts or packs.\n\nHere are some examples of valid run selectors:\n\n```\none/hello/1-5\nfolder/%/3\nroot/1,3,5\nroot/web,db/4-5/install\n```\n\nRun selectors match all scripts and packs that fit the criteria.\n\n#### Numbers\n\nNumbers match index of the script or pack. For example, `1` matches:\n\n```\n01-setup.bash\n1-folder/\n```\n\nNumbers can still match multiple files.\n\n#### Ranges\n\nYou can also use ranges. For example, `1-3` would match:\n\n```\n01-setup.bash\n02-install.bash\n03-configure.bash\n```\n\n#### Names\n\nNames match the unindexed name part of the script or pack. For example, `run/setup` would match:\n\n```\n01-setup.bash\n02-setup.bash\n1-setup/\n```\n\nNames are the only way to match unnumbered scripts and packs. However, unnumbered packs can still contain numbered scripts that can be matched using numbers or ranges.\n\n#### Commas\n\nCommas let you combine multiple references. For example, `1,3,go` would match:\n\n```\n01-setup.bash\n03-install.bash\n1-go/\n```\n\n#### Wildcards\n\nThe `%` symbol acts as a wildcard that matches all _numbered_ scripts and packs in a folder. For example, `folder/%/3` would match:\n\n```\nroot/1-first/03-configure.bash\nroot/2-second/03-configure.bash\n```\n\n## Config file\n\npacke uses a YAML file to define script roots. The config file is a YAML file.\n\nHere is an example of a config file:\n\n```yaml\nbefore: ./before.bash\nentrypoints:\n  one:\n    path: ./one\n  two:\n    path: ./two\n```\n\nYou can pass the config file to packe using the `-C`/`--config` option or by setting the `PACKE_CONFIG` environment variable.\n\n## Usage\n\nFirst you need to give packe a config file. You can do this in two ways:\n\n- The `-C`/`--config` option which should appear before any command.\n- The `PACKE_CONFIG` env var.\n\nExamples:\n\n```bash\npacke -C example/config.yaml run root/1\n\nexport PACKE_CONFIG=example/config.yaml\npacke run root/1\n```\n\nIn the following examples, **we’ll assume PACKE_CONFIG is set accordingly.**\n\n### Run\n\nThis lets you run script based on run selectors. You can use more than one run selector, separated by spaces.\n\nScripts will be executed in the order specified and lexicographic order within each selector.\n\n```bash\npacke run SELECTOR1 [SELECTOR2 SELECTOR2 ...]\npacke run folder/1-5,extra/5,9,db root/2/stuff\n```\n\n### List\n\nWorks like `run` but lists the names of scripts and packs that would be run by a list of selectors. This doesn’t run prerun scripts.\n\n```bash\npacke list SELECTOR1 [SELECTOR2 SELECTOR2 ...]\npacke list folder/%/4\n```\n\n### Print\n\nThis pretty prints scripts contents with syntax highlighting. All the matched scripts will be printed. For example, this will print script `2` in pack `1`:\n\n```bash\npacke print SELECTOR1 [SELECTOR2 SELECTOR3 ...]\npacke print folder/1/2\n```\n\n## Extra features\n\npacke scripts have some extra features that make them easier to use.\n\n### Prerun scripts\n\nA prerun script is a special script that determines whether to execute a given pack. They're used as a failsafe to make sure sensitive configuration scripts are only executed when certain conditions are met.\n\nPrerun scripts must be named `packe.pre.bash` or `packe.pre.sh`.\n\nWhen you execute a `run` command, packe will go down the pack tree and execute every prerun script it finds. If a prerun script exits with a non-zero status, the entire pack is skipped.\n\nThese prerun scripts will always be executed, no matter how you match the scripts.\n\nFor example, let's say you have:\n\n```\nroot/\n  packe.pre.bash\n  1.first/\n    packe.pre.bash\n    001.setup.bash\n    002.install.bash\n  2.second/\n    01.setup.bash\n    02.install.bash\n```\n\nAnd you run the selector `root/1/setup`. packe will execute the prerun files in the following order:\n\n```\nroot/packe.pre.bash\nroot/1.first/packe.pre.bash\n```\n\nThe script won't be executed if either of those files exits with a non-zero status.\n\nNote that each prerun is executed only once per `run` command, even if multiple scripts in the pack are matched explicitly or you use multiple selectors.\n\n### Echo with colors\n\npacke scripts can use special echo commands to print colored text to the terminal. These commands are:\n\n```bash\necho.red \"This text will be red\"\necho.green \"This text will be green\"\necho.yellow \"This text will be yellow\"\necho.white \"This text will be white\"\necho.blue \"This text will be blue\"\n```\n\n### Echo with levels\n\npacke scripts can also use special echo commands to print text with different levels of importance. These commands are:\n\n```bash\necho.info \"Informational\"\necho.warn \"Warning\"\necho.error \"Error\"\necho.section \"Clearly visible section across several rows\"\n```\n\nAll of these commands print to standard output, but they format the output based on the log level.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgregros%2Fpacke","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgregros%2Fpacke","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgregros%2Fpacke/lists"}