{"id":25629364,"url":"https://github.com/neatshell/generator-bash","last_synced_at":"2026-06-10T11:30:13.006Z","repository":{"id":12366975,"uuid":"71714363","full_name":"neatshell/generator-bash","owner":"neatshell","description":"A generator to scaffold out a shell script, with arguments, options and flags handling","archived":false,"fork":false,"pushed_at":"2023-01-11T01:19:39.000Z","size":877,"stargazers_count":11,"open_issues_count":16,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-14T19:04:43.034Z","etag":null,"topics":["generator","scaffold","shell","shell-script","yeoman"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/neatshell.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}},"created_at":"2016-10-23T16:15:04.000Z","updated_at":"2021-11-25T07:56:11.000Z","dependencies_parsed_at":"2023-01-13T16:55:23.862Z","dependency_job_id":null,"html_url":"https://github.com/neatshell/generator-bash","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/neatshell%2Fgenerator-bash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neatshell%2Fgenerator-bash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neatshell%2Fgenerator-bash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neatshell%2Fgenerator-bash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/neatshell","download_url":"https://codeload.github.com/neatshell/generator-bash/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240222472,"owners_count":19767461,"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":["generator","scaffold","shell","shell-script","yeoman"],"created_at":"2025-02-22T19:17:17.252Z","updated_at":"2026-06-10T11:30:12.968Z","avatar_url":"https://github.com/neatshell.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# generator-bash [![NPM version][npm-image]][npm-url] [![Dependency Status][daviddm-image]][daviddm-url]\nA generator to scaffold out a shell script, with arguments, options and flags handling. \n\n# Table of Contents\n\n- [Installation](#installation)\n- [Initialization](#initialization)\n- [Sub-Generators](#sub-generators)\n- [License](#license)\n\n## Installation\n\nFirst, install [Yeoman](http://yeoman.io) and generator-bash using [npm](https://www.npmjs.com/) ([node.js](https://nodejs.org/) is assumed to be installed )\n\n```bash\n$ npm install -g yo\n$ npm install -g generator-bash\n```\n\n## Initialization\n\nWhen starting a new generable-script project, you will want to: open up a terminal/command prompt, make a new folder, and navigate into it\n\n```bash\n$ mkdir my-generable-script-folder \u0026\u0026 cd $_\n```\n\nthen, run the bash generator.\n\n```bash\n$ yo bash my-script.sh\n```\n\nFollow all the prompts and choose what suits you most for the script you would like to create.\nWhen you finish with all of the prompts, your generable-script will be created.\n\n\u003e NOTE: You can also start with a basic blank project and add what you need later (see [init](#init))\n\nOnce finished, you will see a structure like below:\n\n```\n├── .my-script.sh       # The folder containing all the snippets used to compose\n|   |                   # your script. The snippets are listed in the composing order\n|   ├── .header\n|   ├── .error\n|   ├── .log\n|   ├── .debug\n|   ├── .usage\n|   ├── .get_options\n|   ├── .get_arguments\n|   ├── .init\n|   └── body            # The snippet where to put your own logic\n|\n├── .yo-rc.json         # The yeoman config file where you can change your script config \n|                       # faster than using the provided prompts\n|\n└── my-script.sh        # Your generated script ready to be run\n```\n\nCongratulations! You should now have successfully created a generable-script project.\n\nTo start adding your own logic you can modify the **body** snippet and use the provided **subgenerators** to handle \nARGUMENTs, OPTIONs and FLAGs and also the VERSION of your script. Under the hood, what these subgenerators do, is modifying the \n**.yo-rc.json** configuration file and once understood the mechanisms you can also modify directly this file to speed up \nthe workflow or when there's no way with subgenerators to achieve a task for example: renaming an OPTION long or short name \npreviously created with the main generator or with the option subgenerator.\n\n\u003e NOTE: You should not modify the dotfiles under your generable-script folder, if you want to preserve the automatic\nusage generation and the correct input arguments/options reading\n\n## Sub-Generators\n\n* [bash:argument](#argument)\n* [bash:option](#option)\n* [bash:flag](#flag)\n* [bash:version](#version)\n* [bash:init](#init)\n* [bash:write](#write)\n\n***Note: Generators need to be run from the root directory of your generable-script (Where the .yo-rc.json is located)***\n\n### Argument\nAllows to add an input argument inside your script \n\n#### Example:\n\n```bash\n$ yo bash:argument my-script.sh\n```\n\nFollowing the prompts you will choose your argument's variable name and the optional description to show\ninto the generated usage.\n\n### Option\nAllows to add an input option inside your script \n\n#### Example:\n\n```bash\n$ yo bash:option my-script.sh\n```\n\nFollowing the prompts you will choose your option's variable name, short/long name and the optional description to show\ninto the generated usage.\n\n### Flag\nAllows to add an input flag inside your script \n\n#### Example:\n\n```bash\n$ yo bash:flag my-script.sh\n```\n\nFollowing the prompts you will choose your flag's variable name, short/long name and the optional description to show\ninto the generated usage.\n\n### Version\nAllows to handle the version of your script following [semver](http://semver.org/) specs \n\n#### Example:\n\n```bash\n$ yo bash:version my-script.sh patch\n```\n\nThis will bump the **patch** version of your script changing the output of:\n\n```bash\n$ ./my-script.sh --version\n```\nFrom\n```\n0.1.0\n```\nTo\n```\n0.1.1\n```\nOther possible values are: **minor** and **major** :\n- minor) will bump the minor and reset the patch to 0 e.g. **0.1.1** -\u003e **0.2.0**\n- major) will bump the major and reset the minor and the patch to 0 e.g. **0.2.1** -\u003e **1.0.0**\n\n\nthat respectively also reset the patch to 0 and both the minor and the patch to 0\n\n### Init\nInitializes a bare generable-script with no arguments, options nor flag. You can add them later by using \nthe respective subgenerators or by properly modifying the .yo-rc.json\n\n#### Example:\n\n```bash\n$ yo bash:init my-script.sh\n```\nThe output will be\n```\ncreate my-script.sh\n```\n### Write\nCalled internally by every above described generators, it's the piece of code that converts the data stored into\nthe .yo-rc.json into the final generated script. You should use this generator only when the .yo-rc.json has been\nmodified manually to reflect the changes into the script.\n\n```bash\n$ yo bash:write my-script.sh\n```\nThe output will be\n```\nconflict my-script.sh\n? Overwrite my-script.sh? (Ynaxdh)\n```\n\nwith the Yeoman's [conflicter](http://yeoman.io/generator/Conflicter.html) asking you to override the old script. \nPressing return, the default **Y** will be passed and your script will be updated.\n\n\u003e NOTE: This will also run chmod +x **my-script.sh**\n\n## License\n\n[Apache-2.0](LICENSE) / © Claudio Stella\n\n\n[npm-image]: https://badge.fury.io/js/generator-bash.svg\n[npm-url]: https://npmjs.org/package/generator-bash\n[daviddm-image]: https://david-dm.org/neatshell/generator-bash.svg?theme=shields.io\n[daviddm-url]: https://david-dm.org/neatshell/generator-bash\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneatshell%2Fgenerator-bash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneatshell%2Fgenerator-bash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneatshell%2Fgenerator-bash/lists"}