{"id":47516106,"url":"https://github.com/danpizz/subshella","last_synced_at":"2026-04-01T07:00:40.926Z","repository":{"id":279685339,"uuid":"939549232","full_name":"danpizz/subshella","owner":"danpizz","description":"A handy way to interactively manage bash environment variables","archived":false,"fork":false,"pushed_at":"2025-07-09T21:02:04.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-10T06:56:15.747Z","etag":null,"topics":[],"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/danpizz.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,"zenodo":null}},"created_at":"2025-02-26T18:06:49.000Z","updated_at":"2025-07-09T21:00:59.000Z","dependencies_parsed_at":null,"dependency_job_id":"c1fd848a-6fc8-41d5-bf5a-9eed0458d374","html_url":"https://github.com/danpizz/subshella","commit_stats":null,"previous_names":["danpizz/chenv","danpizz/subshella"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/danpizz/subshella","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danpizz%2Fsubshella","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danpizz%2Fsubshella/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danpizz%2Fsubshella/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danpizz%2Fsubshella/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danpizz","download_url":"https://codeload.github.com/danpizz/subshella/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danpizz%2Fsubshella/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31269176,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-01T06:57:45.811Z","status":"ssl_error","status_checked_at":"2026-04-01T06:57:42.389Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2026-03-27T13:00:30.244Z","updated_at":"2026-04-01T07:00:40.920Z","avatar_url":"https://github.com/danpizz.png","language":"Shell","funding_links":[],"categories":["\u003ca name=\"cheatsheet\"\u003e\u003c/a\u003eCommands cheatsheet and snippets"],"sub_categories":[],"readme":"# Subshella\n\n**Bash environment group management with interactive selection and secret manager support.**\n\n```\n╭──────────────────────────────────╮╭──────────────────────────────────────────────────────╮\n│   backend-dev                    ││ backend-tests ()                                     │\n│ ▌ backend-tests                  ││ {                                                    │\n│                                  ││     export DB_NAME=prod_db;                          │\n│                                  ││     export DB_HOST=db-test.example.com;              │\n│                                  ││     export USER=$(op read op://vault/tests-db/userna │\n│                                  ││     export PASSWORD=$(op read op://vault/tests-db/pa │\n│                                  ││ }                                                    │\n│                                  ││                                                      │\n│                                  ││                                                      │\n╰──────────────────────────────────╯│                                                      │\n╭──────────────────────────────────╮│                                                      │\n│ \u003e                        2/2 (0) ││                                                      │\n╰──────────────────────────────────╯╰──────────────────────────────────────────────────────╯\n```\n\nSubshella (`ssa`) helps you manage groups of Bash environment variables with an interactive menu, making it quick to activate different configurations — especially when working with dynamic secrets from tools like 1Password CLI (`op`).\n\n**No lock-in**: Your `.ssa` file is just Bash — use it with or without Subshella.\n\n## Features\n\n* Interactive [fzf](https://github.com/junegunn/fzf)-powered menu for selecting and activating environment groups\n\n* Plain Bash function definitions — no special syntax\n\n* Supports dynamic values from secret managers (e.g., 1Password CLI)\n\n* Multiple group selection\n\n* Inspect current environment safely (with secrets obscured)\n\n* Manual sourcing always available\n\n## Installation\n\n### Prerequisites\n\n- `fzf` (for interactive menu)\n- `realpath` (for path resolution)\n- Bash 4.0+ (for associative arrays)\n\n### Install steps\n\n1. Download `ssa.sh` to a directory in your `PATH`:\n   ```\n   curl https://raw.githubusercontent.com/danpizz/subshella/refs/heads/main/ssa.sh \u003e /usr/local/bin/ssa.sh\n   ```\n1. Make it executable: \n   ```\n   chmod +x /usr/local/bin/ssa.sh\n   ```\n1. Ensure `fzf` and `realpath` are installed on your system.\n\n## Usage \n\n### Defining Environment Groups\n\nEnvironment groups are defined in a `.ssa` file in the current directory as Bash functions. For example:\n\n```\ngroup-dev() {\n    export TAG=\"a1\"\n    export DB_NAME=my_local_db\n    export DB_HOST=\n    export MY_SECRET=abc\n}\n\ngroup-prod() {\n    export TAG=\"b\"\n    export DB_NAME=prod_db\n    export DB_HOST=aws.com\n    export DB_USER=$(op read op://vault/name/username)\n    export DB_PASSWORD=$(op read op://vault/name/password)\n}\n```\n\n### Commands\n\n* `ssa`\n\n   Launches an interactive fzf menu to select and apply environment groups in a new shell.\n\n* `ssa -s`\n\n    Shows the currently active environment configuration (secrets obscured).\n\n* `ssa -s -v`\n\n    Shows the current environment with all values revealed.\n\n\n###  Manual Mode\n\nYou can always source .ssa and use the functions directly:\n\n```\n$ . .ssa\n$ group-dev\n$ echo $DB_NAME\nmy_local_db\n```\n\n### Example Workflow\n\n1. Create a `.ssa` file in your project directory with your environment groups.\n1. Run `ssa` to select and apply a group of environment variables, spawning a new shell.\n1. Use `ssa -s` to inspect the active configuration.\n1. Press Ctrl+D to exit the shell and clean up all variables.\n\n## Security \u0026 Customization\n\n* By default, `ssa -s` hides sensitive values (like passwords).\n* To prevent execution of commands other than `op` (the 1Password cli) during inspection, define `NO_OPS` in your `.ssa` file.\n* Need support for more CLI command skipping? [Open an issue!]\n\n### Tip: Shell Level Indicator\n\nIf you use the [Starship prompt](https://starship.rs/), enable its [shlvl](https://starship.rs/config/#shlvl) module to show your current shell level. This makes it easy to see when you’re in a subshell launched by ssa.\n\nAdd this to your `~/.config/starship.toml`:\n\n```\n[shlvl]\ndisabled = false\nthreshold = 1\n```\n\nNow your prompt will show a shell level indicator whenever you’re in a subshell.\n\nGreat for keeping track of when `ssa` has started a new shell.\n\n## License\n\nThis project is licensed under the MIT License.\n\n## Contributing\n\nContributions and suggestions are welcome — open an issue or submit a pull request!\n\n## Acknowledgments\n\nThanks to the creators of fzf and the open-source Bash community for inspiration.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanpizz%2Fsubshella","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanpizz%2Fsubshella","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanpizz%2Fsubshella/lists"}