From bd593aace25c2e74ca3acb62b0228efa083f9479 Mon Sep 17 00:00:00 2001 From: Clay Jensen-Reimann Date: Mon, 1 Apr 2019 09:55:12 -0500 Subject: [PATCH 1/2] Clarify naming of external command files It was not clear (to me, at least) that non-ruby external commands should not contain a file suffix. Homebrew will ignore a file `cmd/brew-extcmd.sh` instead of printing a warning or registering it as `brew extcmd.sh` --- docs/External-Commands.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/docs/External-Commands.md b/docs/External-Commands.md index b24b030b7a..54b5986ec2 100644 --- a/docs/External-Commands.md +++ b/docs/External-Commands.md @@ -18,8 +18,8 @@ An external command `extcmd` implemented as a Ruby command should be named `brew The command may `Kernel.exit` with a status code if it needs to; if it doesn't explicitly exit then Homebrew will return `0`. -### Shell scripts -A shell script for a command named `extcmd` should be named `brew-extcmd`. This file will be run via `exec` with some Homebrew variables set as environment variables, and passed any additional command-line arguments. +### Other executable scripts +An execuatable script for a command named `extcmd` should be named `brew-extcmd`. The script itself can use any suitable shebang (`#!`) line, so an external script can be written in sh, bash, Ruby, or anything else. Unlike the ruby commands this file must not end with a language-specific suffix (`.sh`, or `.py`). This file will be run via `exec` with some Homebrew variables set as environment variables, and passed any additional command-line arguments. | Variable | Description | |------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------| @@ -29,8 +29,6 @@ A shell script for a command named `extcmd` should be named `brew-extcmd`. This | `HOMEBREW_PREFIX` | Where Homebrew installs software. This is always the grandparent directory of the `brew` executable, `/usr/local` by default. | | `HOMEBREW_REPOSITORY` | If installed from a Git clone, the repository directory (i.e. where Homebrew’s `.git` directory lives). | -Note that the script itself can use any suitable shebang (`#!`) line, so an external “shell script” can be written for sh, bash, Ruby, or anything else. - ## Providing `--help` All internal and external Homebrew commands can provide styled `--help` output by using lines starting with `#:` (a comment then `:` character in both Bash and Ruby) which are then output by `--help`. From fa7183726eaab7dfcedde9e434a02165714b1e3f Mon Sep 17 00:00:00 2001 From: Clay Jensen-Reimann Date: Mon, 1 Apr 2019 15:53:39 -0500 Subject: [PATCH 2/2] Fix typo, suggest python --- docs/External-Commands.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/External-Commands.md b/docs/External-Commands.md index 54b5986ec2..f8030d88e7 100644 --- a/docs/External-Commands.md +++ b/docs/External-Commands.md @@ -19,7 +19,7 @@ An external command `extcmd` implemented as a Ruby command should be named `brew The command may `Kernel.exit` with a status code if it needs to; if it doesn't explicitly exit then Homebrew will return `0`. ### Other executable scripts -An execuatable script for a command named `extcmd` should be named `brew-extcmd`. The script itself can use any suitable shebang (`#!`) line, so an external script can be written in sh, bash, Ruby, or anything else. Unlike the ruby commands this file must not end with a language-specific suffix (`.sh`, or `.py`). This file will be run via `exec` with some Homebrew variables set as environment variables, and passed any additional command-line arguments. +An executable script for a command named `extcmd` should be named `brew-extcmd`. The script itself can use any suitable shebang (`#!`) line, so an external script can be written in Bash, Ruby, or even Python. Unlike the ruby commands this file must not end with a language-specific suffix (`.sh`, or `.py`). This file will be run via `exec` with some Homebrew variables set as environment variables, and passed any additional command-line arguments. | Variable | Description | |------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|