-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create binary.md documentation #28822
Conversation
Closes #25423.
@@ -0,0 +1,48 @@ | |||
# binary | |||
|
|||
In the simple case of a string argument to `binary`, the source file is linked into the `/usr/local/bin` folder on installation. For example (from [operadriver.rb](https://github.com/caskroom/homebrew-cask/blob/60531a2812005dd5f17dc92f3ce7419af3c5d019/Casks/operadriver.rb#L11)): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we usually call them “directories” not “folders”. Or maybe we’re inconsistent on that. I prefer the former.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
creates a symlink to: | ||
|
||
```bash | ||
/usr/local/bin/operadriver |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn’t strictly true. In practice we use $(brew --prefix)/bin
. Most of the time that will translate to /user/local/bin
, but not always. See #21372.
Fixing it in https://github.com/caskroom/homebrew-cask/blob/master/doc/cask_language_reference/all_stanzas.md (#28837).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
/usr/local/bin/operadriver | ||
``` | ||
|
||
from a source file such as: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don’t think this section is necessary. It’s not that useful to know where it’s linked from, that’s a more advanced detail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I followed the same language as used in app.md which says the same thing.
Happy to remove it, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can remove it from app.md
as well. As long as it’s consistent, I’ll leave it to what you find is clearer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that it is better in the binary because it actually is a symlink, and users would like to know where the symlink points to.
It can be removed from app.md
though, I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that it is better in the binary because it actually is a symlink, and users would like to know where the symlink points to.
It can be removed from
app.md
though, I think.
Agreed.
|
||
## Renaming the Target | ||
|
||
You can rename the target which appears in your `/usr/local/bin` directory by adding a `target:` key to `binary`, for example to be to be consistent with other command-line tools like [changing case](https://github.com/caskroom/homebrew-cask/blob/070a3bdeadf339892268d79aded9108ba7960f32/Casks/praat.rb#L12): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can name it “binaries directory” or something, here, instead of /usr/local/bin
, since as previously noted, it might not be that location.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The examples could be taken directly from https://github.com/caskroom/homebrew-cask/blob/master/doc/cask_language_reference/stanzas/app.md#target-should-only-be-used-in-select-cases, for consistency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can name it “binaries directory” or something, here, instead of /usr/local/bin, since as previously noted, it might not be that location.
Fixed.
The examples could be taken directly from https://github.com/caskroom/homebrew-cask/blob/master/doc/cask_language_reference/stanzas/app.md#target-should-only-be-used-in-select-cases, for consistency.
That is where I got them from.
binary 'minishift-darwin-amd64', target: 'minishift' | ||
``` | ||
|
||
## target: May Contain an Absolute Path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While useful, this part is referring to artifact
, not binary
. We don’t want to encourage absolute paths in binary, target:
. The section should be removed or made clearer that it is referring to artifact
as a companion to binary
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, I followed the same language as used in app.md which says the same thing.
Happy to remove it, though.
Although the example is nice, as it is a binary
example.
Might actually make more sense to remove this from app.md
also and leave it in binary.md
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets do one better. I think that I was the one to originally write these, and that I put target
in app.md
for lack of a better place. We could either:
- Split the documentation of
target:
to a new document and link there from bothapp.md
andbinary.md
- Remove all
target:
documentation frombinary.md
and link to the section inapp.md
.
I’m partial to the second one (seems to be as clear, and requires less files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good to me. Please add the third example, though, about cleaning up the name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm offline for a while - please fell free to edit the file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’m instead removing mentions of binary
.
In this document, we can say that for target:
, the app.md
document should be followed, but that the select cases don’t apply as rigidly and it’s fine to take some extra liberties with target:
to be consistent with other command-line tools, like changing case, removing an extension, or cleaning up the name.
This way it’ll be more consistent with what we do with the other repos (we tell users to check the rules in this one, and point out the differences there).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I Agree.
Thanks for all the help @vitorgalvao. |
@miccal Thank you for starting it in the first place. |
Closes #25423.