{"id":17169876,"url":"https://github.com/a1ecbr0wn/pshell","last_synced_at":"2025-04-13T16:06:24.346Z","repository":{"id":38292093,"uuid":"481162031","full_name":"a1ecbr0wn/pshell","owner":"a1ecbr0wn","description":"Works out if this is running from inside a shell, and if so, which one.","archived":false,"fork":false,"pushed_at":"2025-04-01T18:30:50.000Z","size":56,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-13T16:06:13.715Z","etag":null,"topics":["bash","ksh","rust","rust-lang","shell"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/pshell","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/a1ecbr0wn.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":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-13T09:58:11.000Z","updated_at":"2025-04-01T18:30:48.000Z","dependencies_parsed_at":"2024-06-17T18:47:11.001Z","dependency_job_id":"46d7496b-1d8a-435d-82b9-8459efdaa9ef","html_url":"https://github.com/a1ecbr0wn/pshell","commit_stats":{"total_commits":25,"total_committers":4,"mean_commits":6.25,"dds":0.4,"last_synced_commit":"71c7ff14dc6fe4810d000464cac5392a61a73ae2"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a1ecbr0wn%2Fpshell","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a1ecbr0wn%2Fpshell/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a1ecbr0wn%2Fpshell/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a1ecbr0wn%2Fpshell/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/a1ecbr0wn","download_url":"https://codeload.github.com/a1ecbr0wn/pshell/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248741205,"owners_count":21154254,"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":["bash","ksh","rust","rust-lang","shell"],"created_at":"2024-10-14T23:27:39.309Z","updated_at":"2025-04-13T16:06:24.287Z","avatar_url":"https://github.com/a1ecbr0wn.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!-- markdownlint-configure-file {\n  \"MD033\": false,\n  \"MD041\": false\n} --\u003e\n\n# pshell\n\n[![Crates.io](https://img.shields.io/crates/l/pshell)](https://github.com/a1ecbr0wn/pshell/blob/main/LICENSE) [![Crates.io](https://img.shields.io/crates/v/pshell)](https://crates.io/crates/pshell) [![Build Status](https://github.com/a1ecbr0wn/pshell/workflows/CI%20Build/badge.svg)](https://github.com/a1ecbr0wn/pshell/actions/workflows/build.yml) [![docs.rs](https://img.shields.io/docsrs/pshell)](https://docs.rs/pshell) [![dependency status](https://deps.rs/repo/github/a1ecbr0wn/pshell/status.svg)](https://deps.rs/repo/github/a1ecbr0wn/pshell)\n\n`pshell` answers the question \"Is my application running in a shell, and if so, which one?\".\n\nExample: you are installing something and want to make changes to the shell and you want to know what changes are required to which shell script.\n\n\u003cdiv align=\"center\"\u003e\n\n[Usage](#usage) - [Contribute](#contribute)\n\n\u003c/div\u003e\n\n## Usage\n\nJust a simple function that tells you whether the application is run from inside a shell:\n\n``` rust\nuse pshell;\n\nfn main() {\n    // `find` returns the name of the shell in a string and the pid as a u32\n    let (sh, pid) = pshell::find().unwrap_or((\"unknown\".to_string(), 0));\n    println!(\"This application has been run from pid `{}`, which is a {} shell\", pid, sh);\n}\n```\n\nTo try this out, and check it works OK on your OS/shell combination run the following from your shell:\n\n``` bash\ncargo run --example what_shell\n```\n\n## Why should you use this crate?\n\nIt is a small, simple crate that adds very little to your application size for discovering what shell this is running under by inspecting the name of the parent processes against a limited list of known shells.\n\n## Why should you not use this crate?\n\nYou want an all-singing, all-dancing crate that identifies any knowns shell.\n\n## Contribute\n\nI have created a list of shells where this could be run from, it is not exhaustive, if your shell is not supported, feel free to raise an issue or a PR.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fa1ecbr0wn%2Fpshell","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fa1ecbr0wn%2Fpshell","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fa1ecbr0wn%2Fpshell/lists"}