{"id":22331081,"url":"https://github.com/rodrigobdz/styleguide-sh","last_synced_at":"2025-03-26T07:11:02.412Z","repository":{"id":119408331,"uuid":"340873413","full_name":"rodrigobdz/styleguide-sh","owner":"rodrigobdz","description":"Personal Style Guide for Shell Scripts","archived":false,"fork":false,"pushed_at":"2021-04-28T21:02:02.000Z","size":5,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-31T08:35:08.424Z","etag":null,"topics":["best-practices","coding-standards","coding-style","opinionated","rules","shell-script","standard"],"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/rodrigobdz.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}},"created_at":"2021-02-21T10:27:30.000Z","updated_at":"2023-05-19T10:18:50.000Z","dependencies_parsed_at":null,"dependency_job_id":"78f02522-f351-497c-b05c-cf5bc6f8a9bc","html_url":"https://github.com/rodrigobdz/styleguide-sh","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rodrigobdz%2Fstyleguide-sh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rodrigobdz%2Fstyleguide-sh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rodrigobdz%2Fstyleguide-sh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rodrigobdz%2Fstyleguide-sh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rodrigobdz","download_url":"https://codeload.github.com/rodrigobdz/styleguide-sh/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245605730,"owners_count":20643030,"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":["best-practices","coding-standards","coding-style","opinionated","rules","shell-script","standard"],"created_at":"2024-12-04T04:09:37.186Z","updated_at":"2025-03-26T07:11:02.407Z","avatar_url":"https://github.com/rodrigobdz.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [rodrigobdz](https://github.com/rodrigobdz)'s Shell Style Guide\n\nOpinionated guide on how to organize scripts and which rules to follow while writing them.\n\n[Motivation](https://github.com/github/scripts-to-rule-them-all#the-idea)\n\n## Usage\n\n### File Naming Convention\n\nWe follow a modified version of [github/scripts-to-rule-them-all](https://github.com/github/scripts-to-rule-them-all):\n\n- [`utils.sh`](./utils.sh) - shared functions and variables\n- [`script/bootstrap`](./script/bootstrap) - installs all dependencies\n- `script/setup` - sets up a project to be used for the first time\n- `script/update` - updates a project to run at its current version\n- `script/build` - builds package\n- `script/up` - starts app\n- `script/test` - runs tests\n- `script/console` - opens a console for your application.\n- `script/cibuild` - invoked by continuous integration servers to run tests\n\nIf script targets a specific OS version, add it to the filename after a hyphen. We like hyphens.\n\nExample: `script/bootstrap-mac` or `script/bootstrap-centos`\n\n#### File Extensions\n\n\u003e Executables should have **no extension**.\n\u003e\n\u003e Libraries **must have** a .sh **extension** and should not be executable.\n\nSource: [Google's Shell Style Guide](https://google.github.io/styleguide/shell.xml#File_Extensions)\n\n### Code Style\n\n- [Google Shell Style Guide](https://google.github.io/styleguide/shell.xml) - Set of best practices, additional to linter use.\n\n  Only modifications are:\n\n  - [Shebang](https://google.github.io/styleguide/shell.xml?showone=Which_Shell_to_Use#Which_Shell_to_Use): `#!/usr/bin/env bash`\n  - Shell Options:\n\n    ```sh\n    shopt -s inherit_errexit\n    set -o errexit # Abort script at first error\n    set -o pipefail # Return last non-zero status in pipeline\n    set -o nounset # Exit if any variable is undefined\n    # Optional\n    set -o verbose # Print commands before executing them\n    ```\n\n  - Source Filenames: We prefer **hyphens** instead of underscores.\n\n- [ShellCheck](https://github.com/koalaman/shellcheck) - Linter\n\n#### Example\n\n```sh\n#!/usr/bin/env bash\n#\n# Install all project dependencies.\n\nshopt -s inherit_errexit\nset -o errexit\nset -o pipefail\nset -o nounset\n```\n\n## License\n\n[MIT](license) © [rodrigobdz](https://github.com/rodrigobdz)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frodrigobdz%2Fstyleguide-sh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frodrigobdz%2Fstyleguide-sh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frodrigobdz%2Fstyleguide-sh/lists"}