{"id":21455493,"url":"https://github.com/zeppaman/bashy","last_synced_at":"2025-06-16T23:02:00.909Z","repository":{"id":64404265,"uuid":"484340801","full_name":"zeppaman/bashy","owner":"zeppaman","description":"Bashy saves hundreds of hours by managing input parsing in command line tools and share script like artifact.","archived":false,"fork":false,"pushed_at":"2023-10-27T09:14:59.000Z","size":100,"stargazers_count":27,"open_issues_count":4,"forks_count":8,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-16T23:01:32.511Z","etag":null,"topics":["bash","hacktoberfest","hacktoberfest-2022","repository","script"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-2.1","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zeppaman.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}},"created_at":"2022-04-22T07:38:15.000Z","updated_at":"2025-03-20T02:23:05.000Z","dependencies_parsed_at":"2023-01-27T03:46:24.819Z","dependency_job_id":"7c3ff105-131a-4f2d-82f0-f42aa9a3670f","html_url":"https://github.com/zeppaman/bashy","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/zeppaman/bashy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeppaman%2Fbashy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeppaman%2Fbashy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeppaman%2Fbashy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeppaman%2Fbashy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zeppaman","download_url":"https://codeload.github.com/zeppaman/bashy/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeppaman%2Fbashy/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260256221,"owners_count":22981804,"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","hacktoberfest","hacktoberfest-2022","repository","script"],"created_at":"2024-11-23T05:12:25.380Z","updated_at":"2025-06-16T23:01:59.944Z","avatar_url":"https://github.com/zeppaman.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bashy\nBashy is a script collector for bash system. It allows to download and collect scripts, and facilitates argument parsing.\n\n# Why I should use Bashy for my script\nBashy provides a easy way for resolving arguments and generating an useful Help.\nYou can simply have variable filled with values entered by the user by default, and the help infos build automatically from the script definition. This transofrms your bash script in a real console application with no pain\n\n# How to install\nThe installation package is available for windows and linux. It was tested on Window 10\u002611, Ubuntu, Debian and Alpine. If the binay is not compatible with your OS or processor, you can compile it from source (see next section).\n\n## Instal on Linux\n\nCopy the next piece of code and run in your terminal. \n\n```bash\ncurl -LO https://github.com/zeppaman/bashy/releases/download/latest/bashy.linux \u0026\u0026  install  -m 0755 ./bashy.linux /usr/bin/bashy \u0026\u0026 rm ./bashy.linux \u0026\u0026 echo 'export PATH=\"$PATH:$HOME/.bashy/bin\"'\u003e\u003e~/.bashrc \u0026\u0026  echo 'export PATH=\"$PATH:$HOME/.bashy/bin\"'\u003e\u003e~/.profile \u0026\u0026  echo 'export PATH=\"$PATH:$HOME/.bashy/bin\"'\u003e\u003e/etc/environment \u0026\u0026 export PATH=\"$PATH:$HOME/.bashy/bin\"\n```\n*note*: basing on your os you may need to be root to run the command. Requires curl installed.\n\n## Install on windows\nOpen a powershell console with elevated privileges and run:\n\n```ps\n$bashyHome=$([Environment]::GetFolderPath(\"UserProfile\"))+\"\\.bashy\";  New-Item -ItemType Directory -Force -Path $bashyHome\\bin;  (New-Object System.Net.WebClient).DownloadFile('https://github.com/zeppaman/bashy/releases/download/latest/bashy.windows', \"$bashyHome\\bin\\bashy.exe\");  $old = [Environment]::GetEnvironmentVariable(\"Path\", [System.EnvironmentVariableTarget]::User);    $env:Path= \"$old;$bashyHome\\bin\";  [Environment]::SetEnvironmentVariable(\"Path\", \"$old;$bashyHome\\bin\", [System.EnvironmentVariableTarget]::User);\n```\n\n\n# Compiling from source\n\n# Linux or WSL\n```bash\ngit clone \u003cthis repo url\u003e bashy\ncd bashy\nbash ./install.sh\n```\nThe script build executables in out folder. Copy them where you want and make sure to add the binary location on PATH and the /bin subfloder of BASHY_HOME folder (default is .bashy inside you home/profile folder)\n\ninstallation notes:\n- this compile bashy form source, so you can delete the folder at the end\n- the tool download and install go if not present. If present, nothing is touched but it have to be updated manually to the 1.19 version.\n\n# Windows\n```\ngit clone \u003cthis repo url\u003e bashy\nSet-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; ./install.ps1\n#rm -rf bashy optional\n```\nDespite that golang can produce multiplatform output and that this app could be improved to support multiple script engines (js,c#, etc..) and OS (windows, mac), at the moment the application is working only with linux and bash scripts.\n\n# How is it possible?\nThe script hash a YAML file associated with it, so you can define all the infos. In the following example we are defining a command named `sample` with two parameters (`name, surname`).\n\n```yaml\nname: Name\ndescription: the command description\nargsusage: help text\nparams:\n  - name: \"name\"\n    desc: \"enter your name\"\n  - name: \"surname\"\n    desc: \"enter your surname\"\n```\nThis will allow you to use directly the parameter names as named variables. So, your script will be able to do something similar to:\n\n```bash\necho \"$name\"\necho \"$surname\"\necho \"$name $surname\"\n```\nMoreover, you will be able to list all the commands available, and for each commands the help usage.\n\n# How can I share my script\nEach yaml file can contains one or more command definition. Commands can be:\n- embedded (the script is contained inside the yaml file definition)\n- linked to an external files (local or remote)\n\nYou can work on-the-fly scripts on the current directory or move them to the internal report and make them available at OS level. Moreover you can publish scripts over HTTP and download it locally.\n\n## Download a script and add it locally\n```bash\nbashy repo add https://xxx.yy/path.yml\n```\nThis will download all related scripts and save them locally. The home of bashy is `.bashy` on the user's home.\n\n\n## Run a script on current folder\nYou can run scripts on a foder witout installing them on bashy by specifing the `BASHY_EXTRA` (additional folder where the app looks for yaml) and `BASHY_FILES (a list of files path to add).\n```bash\nBASHY_EXTRA=samples/home go run ./src/main.go \nBASHY_FILES=myfile.yml,/var/scripts/myscript2.yml bashy\n```\n\n## Add a script to bashy\n```bash\nbashy repo add filepath.yml\n```\n\n# How to use it\nHere some commands for usage.\n```bash\nbashy --help #list all commands with description\n\n# NAME:\n#    Bashy - A new cli application\n\n# USAGE:\n#    main [global options] command [command options] [arguments...]\n\n# COMMANDS:\n#    command1           \n#    command2  \n\n# GLOBAL OPTIONS:\n#    --help, -h  show help (default: false)\n\nbashy command1 --help # show infos about the command\n\n# NAME:\n#    command1 \n\n# USAGE:\n#    bashy command1 [command options] [arguments...]\n\n# DESCRIPTION:\n#    the command description\n\n# OPTIONS:\n#    --name value     enter your name\n#    --surname value  enter your surname\n#    --help, -h       show help (default: false)\n\nbashy \u003ccommand name\u003e parameters args # execute the command\n\n# the command output\n```\n\n# How to embed a script\nSome samples about how to embed a script.\n## Single command\nYou can write a command using \n```yaml\nname: Name\ndescription: the command description\nargsusage: help text\nparams:\n  - name: \"name\"\n    desc: \"enter your name\"\n  - name: \"surname\"\n    desc: \"enter your surname\"\ncmd: |\n echo \"commmand\"\n env\n echo \"$name $surname\"\n\n```\nor you can concatenate all commands in a single line if you want to keep things more hard to understand:\n```yaml\nname: Name\ndescription: the command description\nargsusage: help text\nparams:\n  - name: \"name\"\n    desc: \"enter your name\"\n  - name: \"surname\"\n    desc: \"enter your surname\"\ncmd:  echo \"commmand\" \u0026\u0026  env  echo \"$name $surname\"\n```\n\n## Multiline script\nIn case you want to define multiple command you can define it by adding multiple `cmds` nodes. Each one can cantain multiple statement like in the Singleline script case. Cmd and Cmds can coexists: Cmd is executed AFTER the Cmds list.\n```yaml\nname: Name\ndescription: the command description\nargsusage: help text\ncmd: echo \"commmand\" \u0026\u0026 env\nparams:\n  - name: \"name\"\n    desc: \"enter your name\"\n  - name: \"surname\"\n    desc: \"enter your surname\"\ncmds:\n    - echo \"$name\"\n    - echo \"$surname\"\n    - echo \"$name $surname\"\n```\n\n# How include an external script\nAn external script can be included. The external script is not exclusive: you can use it in conjunction with  `cmd, cmds` arguments, but loaded at the end. You can specify a local path (relative or absolute), or an URL. The remote script will be downloaded at the first usage then cached locally. Examples:\n**Remote script**\n```yaml\nscript: https://gist.githubusercontent.com/zeppaman/bbdfbac1304f88df1b905692e42f4d4e/raw/22ab3a2163f6ea481bca1b5d5570a964120a4f89/test-bashy.sh\n```\n\n**Local relative path**\nThe path is relative to the same location\n```yaml\nscript: ./test-bashy.sh\n```\n\n**Local absolute path**\n```yaml\nscript: /test-bashy.sh\n```\nNote: absolute paths are not changed during the import/execution process\n\n# Extend Bashy \nThe engine of bashy support any kind of script interpreter but it is shipped with sh for Linux and cmd for windows.\nTo add a new one just create a file like the following (this piece of code add the nodejs interpreter):\n```yaml\nname: node\nparams:\n  - node\n  - $filename\nos: linux\ninstallscript:\n  - #!/bin/bash\n  - echo \"installing dependencies (node)\"\n  - '[[ \"$(command -v apt)\" ]] || { apt install nodejs -y; }'\n  - exit 0\nvariabletemplate: var $name=\"$value\";\n```\nImportant fields are:\n**name** the name of the interpreter. Into script YAML you will set the interpreter parameter to match this.\n- **params** a list of parameters to run the script. The placeholder `$filename` will be replaced with the temporary path of the script that will be generated during the script run. The list in the example will be transformed into `node /`path/to/file`\n- **os** the name of the os where the interpreter can be interpreted. If you have an interpreter that can be used in two different OS, you have to duplicate it\n- **installscript** list of script steps for installing the interpreter. In the example above, it checks if apt is available, then installs node\n- **variabletemplate** the template for adding variables on top of the script, `$name`` and `$value` are placeholders that will hold the param name and value as defined in the command YAML.\n\nThe installation of the interpreter can be done by using the `interpreter` command, like in the following example:\n\n```bash\nbash interpreter add samples/interpreter.yml\n```\n\nyou can check the list of the loaded interpreters by typing:\nOnce the interpreter is installed, you can use it by adding the field `interpreter:\n\n```yaml\nname: Name\ndescription: the command description\nargsusage: help text\ncmd: ...\ninterpreter: node\n```\n\n## Default interpreters\n\nBashy ships a set of default interpreters based on the OS. The list is the following.\n\n| OS  | Name | Default |\n| ------------- | ------------- | ------------- |\n| LINUX | sh  | YES |\n| WINDOWS  | cmd  | YES |\n\n# Change default home\n\n```bash\nBASHY_HOME=samples bashy\n```\n\n# Debug\n```bash\nBASHY_HOME=tmp/home go run ./src/main.go \nBASHY_HOME=tmp/home  BASHY_EXTRA=samples/home go run ./src/main.go \n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzeppaman%2Fbashy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzeppaman%2Fbashy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzeppaman%2Fbashy/lists"}