{"id":15211104,"url":"https://github.com/happycod3r/zsh-toggles","last_synced_at":"2026-02-01T03:02:22.410Z","repository":{"id":177751761,"uuid":"660817261","full_name":"happycod3r/zsh-toggles","owner":"happycod3r","description":"Allows you to toggle the value of a variable in a file","archived":false,"fork":false,"pushed_at":"2023-07-04T18:13:24.000Z","size":2194,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-16T08:06:23.879Z","etag":null,"topics":["file-parsing","parsing","shell","shell-script","terminal","v1","zsh","zsh-toggle","zshell","zshrc"],"latest_commit_sha":null,"homepage":"","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/happycod3r.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}},"created_at":"2023-06-30T23:38:41.000Z","updated_at":"2023-08-02T00:14:08.000Z","dependencies_parsed_at":"2023-07-10T23:30:59.648Z","dependency_job_id":null,"html_url":"https://github.com/happycod3r/zsh-toggles","commit_stats":{"total_commits":16,"total_committers":1,"mean_commits":16.0,"dds":0.0,"last_synced_commit":"83556a0973bf497a42635cf3d157251beb332714"},"previous_names":["happycod3r/zsh-toggles"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/happycod3r/zsh-toggles","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/happycod3r%2Fzsh-toggles","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/happycod3r%2Fzsh-toggles/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/happycod3r%2Fzsh-toggles/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/happycod3r%2Fzsh-toggles/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/happycod3r","download_url":"https://codeload.github.com/happycod3r/zsh-toggles/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/happycod3r%2Fzsh-toggles/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28965436,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-01T02:14:24.993Z","status":"ssl_error","status_checked_at":"2026-02-01T02:13:55.706Z","response_time":56,"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":["file-parsing","parsing","shell","shell-script","terminal","v1","zsh","zsh-toggle","zshell","zshrc"],"created_at":"2024-09-28T08:04:47.698Z","updated_at":"2026-02-01T03:02:22.393Z","avatar_url":"https://github.com/happycod3r.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Zsh Toggles v1.1.0\r\n  \r\n## [Table Of Contents](#table_of_contents)\r\n\r\n- [About](#about)\r\n- [Install](#install)\r\n  - [Manual Install](#manual_install)\r\n  - [Command Line Install](#command_line_install)\r\n    - [Using Curl](#using_curl)\r\n    - [Using Git Clone](#git_clone)\r\n- [Usage](#usage)\r\n- [Contributing](#contributing)\r\n- [Security](#security)\r\n- [Contacts](#contacts)\r\n\r\n---\r\n\r\n## [About](#about)\r\n\r\nZsh-Toggle is a function that will allow you to toggle the value of a variable in a file.\r\nIf you want to let a user turn an option on or off in your program you can do it easily with Zsh-Toggle. \r\n\r\n![Example](res/example.gif)\r\n\r\n--- \r\n\r\n## [Install](#install)\r\n\r\nTo download and install zsh-toggles follow choose an install method and follow the corresponding steps. Once\r\nfininshed jump to the [Usage](#usage) section.\r\n\r\n### [Manual Install](#manual_install)\r\n\r\n1. Download and place the ***zsh-toggles*** folder in a location of your choosing.\r\n2. Next source the script as shown in the [Usage](#usage) section. \r\n\r\n### [Command Line Install](#command_line_install)\r\n\r\n#### [Using Git Clone:](#git_clone)\r\n\r\n1) Open your terminal and navigate to the directory where you want to clone the repository: \r\n\r\n```bash\r\ncd where/I/want/to/install\r\n```\r\n\r\n2) Next run the following command to clone the repository to the chosen location:\r\n```bash\r\ngit clone https://github.com/happycod3r/zsh-toggles.git\r\n```\r\n\r\n#### [Using Curl:](#curl)\r\n\r\n1) Pick a directory to download it to:\r\n\r\n```bash\r\ncd where/I/want/\r\n```\r\n\r\n2) Paste the following line into your terminal and press the `Enter (^M)` key:\r\n\r\n```bash\r\ncurl https://github.com/happycod3r/zsh-toggles.git\r\n```\r\n\r\n---\r\n\r\n## [Usage](#usage)\r\n\r\n### Parmeters for zsh-toggle()\r\n\r\n- arg1: `EXPORT`\r\n    - [true|false]   \r\n    - Whether the variable has an `export` statement or not. Default is ***'false'***\r\n- arg2: `DQUOTES`    \r\n    - [true|false|none]   \r\n    - Whether the variable has double quotes, single quotes or none. Default is ***'true'***\r\n- arg3: `VAR_NAME`\r\n    - [string]\r\n    - The name of the variable\r\n- arg4: `VALUE`\r\n    - [string]\r\n    - The current value of the variable\r\n- arg5: `ALT_VALUE`\r\n    - [string]\r\n    - The alternte value for the variable\r\n- arg6: `FILE_PATH`\r\n    - [string]\r\n    - The fully qualified path to the file containing the variable\r\n\r\nIn the file that contains the variable(s) that you want to toggle.\r\nThe variable should ...\r\n- be on a line of its own.\r\n- be only one of the following formats: \r\n  - `$MY_VAR=\"true\"`             no export statement, double quotes\r\n  - `$MY_VAR='true'`             no export statement, single quotes.\r\n  - `$MY_VAR=true`               no export statement, no quotes.\r\n  - `export $MY_VAR=\"true\"`      export statement, double quotes\r\n  - `export $MY_VAR='false'`     export statement, single quotes.\r\n  - `export $MY_VAR=false`       export statement, no quotes.\r\n- be initialized with a value such as true|false, on|off, 1|0, yes|no John|Amy etc.\r\n- It can be any two values that you want to toggle between.\r\n\r\nThe variable you are toggling should be initialized in its \r\nfile already with either VALUE or ALT_VALUE otherwise it won't work.\r\nFor example if you set\r\n\r\n```bash\r\nVALUE=\"yes\"\r\nALT_VALUE=\"no\" \r\n```\r\n\r\nthen in the file @ `FILE_PATH` the variable should be initialized \r\nwith either **\"yes\"** or **\"no\"**. ex. `MY_VAR=\"yes\"` or `MY_VAR=\"no\"`\r\nThe same with the other options too. If you set `DQUOTES` or `EXPORT` to \r\n**\"true\"** then the variable value should be wrapped in double quotes\r\nand/or be exported already in the file. Your basically describing the \r\nvariable with these options\r\n\r\n### Another example: \r\n\r\nIf you call `zsh-toggle` like this\r\n\r\n```bash\r\nzsh-toggle false true TEST \"false\" \"true\" \"$(pwd)/test.conf\"\r\n```\r\n\r\nthen the variable in the file your pointing at with the last argument should look like this:\r\n\r\n```bash\r\nTEST=\"false\"\r\n# or\r\nTEST=\"true\"\r\n```\r\n\r\nIf you call `zsh-toggle` like this\r\n\r\n```bash\r\nzsh-toggle true false TEST \"on\" \"off\" \"$(pwd)/test.conf\"\r\n```\r\n\r\nthen the variable in the file your pointing at with the last argument should look like this:\r\n\r\n```bash\r\nexport TEST='on'\r\n# or\r\nexport TEST='off'\r\n```\r\n\r\nYou can also call `zsh-toggle` passing `\"none\"` for the 2nd argument to use no quotes like this:\r\n\r\n```bash\r\nzsh-toggle false none TEST \"false\" \"true\" \"$(pwd)/test.conf\"\r\n```\r\n\r\nIn this case the variable in the file your pointing at with the last argument should look like this:\r\n\r\n```bash\r\nTEST=false\r\n# or\r\nTEST=true\r\n```\r\n---\r\n\r\n## [Contributing](#contributing)\r\n\r\nIf you have any feature requests, suggestions or general questions you can reach me via any of the methods listed below in the [Contacts](#contacts) section.\r\n\r\n---\r\n\r\n## [Security](#security)\r\n\r\n### Reporting a vulnerability or bug?\r\n\r\n**Do not submit an issue or pull request**: A general rule of thumb is to never publicly report bugs or vulnerabilities because you might inadvertently reveal it to unethical people who may use it for bad. Instead, you can email me directly at: [paulmccarthy676@gmail.com](mailto:paulmccarthy676@gmail.com). I will deal with the issue privately and submit a patch as soon as possible.\r\n\r\n---\r\n\r\n## [Contacts](#contacts)\r\n\r\n**Author:** Paul M.\r\n\r\n* Email: [paulmccarthy676@gmail.com](mailto:paulmccarthy676@gmail.com)\r\n* Github: [https://github.com/happycod3r](https://github.com/happycod3r)\r\n* Linkedin: [https://www.linkedin.com/in/paul-mccarthy-89165a269/]( https://www.linkedin.com/in/paul-mccarthy-89165a269/)\r\n* Facebook: [https://www.facebook.com/paulebeatz]( https://www.facebook.com/paulebeatz)\r\n\r\n---\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhappycod3r%2Fzsh-toggles","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhappycod3r%2Fzsh-toggles","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhappycod3r%2Fzsh-toggles/lists"}