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
topfew 1.0.0 (new formula) #170968
base: master
Are you sure you want to change the base?
topfew 1.0.0 (new formula) #170968
Conversation
Topfew is a dependency-free Golang command-line utility. The command is "tf". If you entered tf -f 7 that would do the equivalent of awk '{print $7}' | sort | uniq -c | sort -nr | head i.e., find and print out the ten most common values of field number 7 in records read from stdin. It has lots of options to select fields. It is significantly faster than the shell pipeline above and, in the case where it's applied to a named file as opposed to stdin, much much faster because it divides the file into segments and process them in multiple threads. The github repo is https://github.com/timbray/topfew It has decent README.md and CONTRIBUTING.md files and I'm working on an INSTALLING.md which, if this is accepted, would include "brew install topfew". Its development is rather fully described in a series of blog posts, see https://www.google.com/search?as_q=topfew&as_sitesearch=tbray.org This 1.0.0 release is discussed in https://www.tbray.org/ongoing/When/202x/2024/04/12/Topfew-release
Thanks for contributing to Homebrew! 🎉 It looks like you're having trouble with a CI failure. See our contribution guide for help. You may be most interested in the section on dealing with CI failures. You can find the CI logs in the Checks tab of your pull request. |
Signed-off-by: Tim Bray <tbray@textuality.com>
Formula/t/topfew.rb
Outdated
depends_on "go" => :build | ||
|
||
def install | ||
system "go", "build", "-trimpath", "-o", "topfew" |
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.
system "go", "build", "-trimpath", "-o", "topfew" | |
system "go", "build", "-trimpath", *std_go_args(out: bin/"tf") |
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 doesn't seem to work, see https://gist.github.com/timbray/9d75ab13868d0ca8851b7123d6c72ead
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.
It's probably output:
then
Formula/t/topfew.rb
Outdated
end | ||
|
||
test do | ||
assert_match "1 bar", shell_output("echo 'foo bar' | #{bin}/tf -f 2") |
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.
assert_match "1 bar", shell_output("echo 'foo bar' | #{bin}/tf -f 2") | |
assert_match "1 bar", pipe_output("#{bin}/tf -f 2", "foo bar") |
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 problem was that the build step was failing, it didn't like *std_go_args(out: bin/"tf")
. Having fixed that, I discovered that pipe_output("#{bin}/tf -f 2", "foo bar")
also doesn't work, while my original formulation, assert_match "1 bar", shell_output("echo 'foo bar' | #{bin}/tf -f 2")
does work. Are we perhaps using a different version of brew?
I might think the binary might need a better name than tf, as tf is popular alias to terraform. |
Signed-off-by: Tim Bray <tbray@textuality.com>
Pardon the sloppy follow-up commit messages. I'm happy to let brew's CI go ahead and auto-squash, I haven't done a rebase/squash in like a year and would be happy to avoid re-learning that stuff. |
Hmm, maybe? Terraform is about to become known as OpenTofu… Maybe "tfw". Maybe produce two binaries, "topfew" and "tf"? I don't have strong opinions on this. |
yeah, tf could be used for both (it would mostly ease the |
Strictly, there's no need for |
if you look at coreutils for gnu drop-in replacements, we did the rename as well, so is true for jruby stuff, I dont think it is that beneficial to introduce the conflicts. In other words, you probably should consider to do the tap host. |
Thanks for the input. Unfortunately I'm a newbie here and I'm not sure I understand.
For coreutils, I guess you mean as described in https://apple.stackexchange.com/questions/69223/how-to-replace-mac-os-x-utilities-with-gnu-core-utilities? In this case you put a "g" prefix but also allow people to use unprefixed form by changing PATH. So you are suggesting that the "topfew" form would be linked but "tf" would still be available via changing PATH? (Sorry if this is a dumb question.) I don't understand the jruby comment, I have used "brew install jruby" in the past. I have never seen jruby referred to as anything but jruby.
Um, what does "do the tap host" mean? I'm new to Brew. I would like to say that I'm serious about the status of Terraform, see OpenTofu Announces Fork of Terraform - Terraform is no longer open-source! And it's owned by IBM. I wonder if it's necessary for Brew to make life easier for users of non-OSS IBM product. |
Terraform, and it's successor in Homebrew OpenTofu, are |
Thank @SMillerDev for the sign-off. Is there anything I need to do now to move this along in the Brew context? |
Topfew is a dependency-free Golang command-line utility. The command is "tf". If you entered
that would do the equivalent of
i.e., find and print out the ten most common values of field number 7 in records read from stdin. It has lots of options to select fields. It is significantly faster than the shell pipeline above and, in the case where it's applied to a named file as opposed to stdin, much much faster because it divides the file into segments and process them in multiple threads.
The github repo has decent README.md and CONTRIBUTING.md files and I'm working on an INSTALLING.md which, if this is accepted, would include "brew install topfew".
Its development is rather fully described in a series of blog posts. This 1.0.0 release is discussed in Topfew 1.0.
HOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source <formula>
, where<formula>
is the name of the formula you're submitting?brew test <formula>
, where<formula>
is the name of the formula you're submitting?brew audit --strict <formula>
(after doingHOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source <formula>
)? If this is a new formula, does it passbrew audit --new <formula>
?