{"id":32477000,"url":"https://github.com/linuxuser255/menu_run","last_synced_at":"2026-07-09T03:31:22.309Z","repository":{"id":319761644,"uuid":"1079519825","full_name":"LinuxUser255/menu_run","owner":"LinuxUser255","description":"A simple Rust application that presents an interactive menu and executes shell scripts based on user selection","archived":false,"fork":false,"pushed_at":"2025-10-20T00:47:06.000Z","size":19,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-20T05:49:45.950Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LinuxUser255.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-20T00:41:26.000Z","updated_at":"2025-10-20T00:47:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"f92997c9-eb50-4867-beb9-f822304d4dc9","html_url":"https://github.com/LinuxUser255/menu_run","commit_stats":null,"previous_names":["linuxuser255/menu_run"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/LinuxUser255/menu_run","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LinuxUser255%2Fmenu_run","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LinuxUser255%2Fmenu_run/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LinuxUser255%2Fmenu_run/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LinuxUser255%2Fmenu_run/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LinuxUser255","download_url":"https://codeload.github.com/LinuxUser255/menu_run/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LinuxUser255%2Fmenu_run/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35286002,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-09T02:00:07.329Z","response_time":57,"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":[],"created_at":"2025-10-26T22:48:50.050Z","updated_at":"2026-07-09T03:31:22.304Z","avatar_url":"https://github.com/LinuxUser255.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Menu Run\n\n**A simple Rust application that presents an interactive menu and executes shell scripts based on user selection.**\n\n## Execution Flow\n\nWhen the program starts (`cargo run`), the following execution flow occurs:\n\n```mermaid\nflowchart TD\n    Start([Start main.rs]) --\u003e Loop{Enter Loop}\n    Loop --\u003e Prompt[Display Menu Prompt]\n    Prompt --\u003e Input[Read User Input]\n    Input --\u003e Parse[Convert to lowercase \u0026amp; trim]\n    Parse --\u003e Match{Match Input}\n\n    Match --\u003e|a| ScriptOne[Print shell script one]\n    Match --\u003e|b| ScriptTwo[Print shell script two]\n    Match --\u003e|c| ScriptThree[Print shell script three]\n    Match --\u003e|q/quit/exit| Exit[Print Exiting...]\n    Match --\u003e|Invalid| Invalid[Print Invalid selection]\n\n    ScriptOne --\u003e RunOne[\"runner::run(Script::One)\"]\n    ScriptTwo --\u003e RunTwo[\"runner::run(Script::Two)\"]\n    ScriptThree --\u003e RunThree[\"runner::run(Script::Three)\"]\n\n    RunOne --\u003e ExecOne[Execute ./scripts/shell_script_one.sh]\n    RunTwo --\u003e ExecTwo[Execute ./scripts/shell_script_two.sh]\n    RunThree --\u003e ExecThree[Execute ./scripts/shell_script_three.sh]\n\n    ExecOne --\u003e PrintCode1[Print exit code]\n    ExecTwo --\u003e PrintCode2[Print exit code]\n    ExecThree --\u003e PrintCode3[Print exit code]\n\n    PrintCode1 --\u003e Break1[Break loop]\n    PrintCode2 --\u003e Break2[Break loop]\n    PrintCode3 --\u003e Break3[Break loop]\n    Exit --\u003e Break4[Break loop]\n\n    Invalid --\u003e Loop\n\n    Break1 --\u003e End([End])\n    Break2 --\u003e End\n    Break3 --\u003e End\n    Break4 --\u003e End\n\n```\n\n### Detailed Flow Description\n\n1. **Program Start**: The `main()` function in `src/main.rs` begins execution.\n\n2. **Interactive Loop**: The program enters an infinite loop that:\n   - Displays a menu prompt asking for user selection (A, B, C, or Q/quit/exit)\n   - Flushes stdout to ensure the prompt is immediately visible\n\n3. **User Input Processing**:\n   - Reads a line from stdin\n   - Trims whitespace and converts to lowercase for case-insensitive matching\n   - If reading fails, displays an error and continues the loop\n\n4. **Input Matching**:\n   - **Option A**: Prints \"shell script one\", calls `runner::run(Script::One)`, breaks loop\n   - **Option B**: Prints \"shell script two\", calls `runner::run(Script::Two)`, breaks loop\n   - **Option C**: Prints \"shell script three\", calls `runner::run(Script::Three)`, breaks loop\n   - **Quit (q/quit/exit)**: Prints \"Exiting...\", breaks loop\n   - **Invalid input**: Prints error message, continues loop\n\n5. **Script Execution** (via `src/runner.rs`):\n   - The `run()` function receives a `Script` enum variant\n   - Maps the variant to corresponding script path:\n     - `Script::One` → `./scripts/shell_script_one.sh`\n     - `Script::Two` → `./scripts/shell_script_two.sh`\n     - `Script::Three` → `./scripts/shell_script_three.sh`\n   - Spawns a bash process with the script path as argument\n   - Captures and prints the exit code\n   - Returns the exit code wrapped in `Result\u003ci32\u003e`\n\n6. **Program Termination**: After breaking the loop, prints a blank line and exits.\n\n## Prerequisites\n\n- Rust toolchain (edition 2024)\n- Bash shell\n- Execute permissions on shell scripts: `chmod +x scripts/*.sh`\n\n## Usage\n\n```bash\n# Build the project\ncargo build\n\n# Run the application\ncargo run\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinuxuser255%2Fmenu_run","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flinuxuser255%2Fmenu_run","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinuxuser255%2Fmenu_run/lists"}