Rb

Dev tools

command line utility

SHOW HN2018

232points
73comments
#140of 2,155 in 2018
Top 7%of 2018 by points

How HN took it

MixedNo clear lean

8 positive, 14 neutral or asking, 2 mixed, 6 critical, out of 30 comments about the project. Thread score +0.01.

Idea: 4 for, 3 againstDesign: 2 for, 0 againstExecution: 0 for, 1 against

The thread, comment by comment

Each row is a top-level comment and its replies, in HN's order. Select a cell to open that comment on HN.

positive neutral or mixed critical about another commenter or something else the maker

What HN said

What people liked

  • Nifty and neat idea

    From 3 comments
    • First I thought: This is stupid. But then I watched the examples on github and here in the comments, and I changed my mind: It's pretty neat :) I like it.
      tobyhinloopen on HN
    • its a pretty nifty idea
      jaequery on HN
    • Interesting, so it's reading text from STDIN into an Array, then executing its arguments as Ruby code in the context of that Array (or if you pass -l, in the context of each line…
      Ajedi32 on HN

Objections

  • Reading all input into an array hurts streaming and performance

    From 2 comments
    • The command should process stdin in streaming fashion rather than slurping it all at once: ``` code = ARGV[0] STDIN.each_line do |l| puts l.instance_eval(code) STDOUT.flush end ```
      pulisse on HN
    • - Reading all the lines into an array is a big error. - It's a bit unintiuitive because you don't really know what strings to escape on the bash command line. In the example,…
      tigrezno on HN
  • Install via curl piped to bash is a security concern

    From 2 comments
    • It makes me a little uncomfortable that they're using curl|bash for something as simple as "put this 10-line script somewhere in your $PATH," especially when the script involves…
      KeyboardFire on HN
    • Yeah, and it's not even getting the code from an official source; it's coming from a random bit.ly link [created by a contributor][1]. I've [submitted a PR][2] to inline the…
      Ajedi32 on HN
  • Standard Ruby one-liners or awk/perl already do this

    From 3 comments
    • What does this have over the default ruby? cat your-file.txt | ruby -ne '$_.your_ruby_stuff' Just syntactic sugar? (it does look cleaner!)
      meow_mix on HN
    • ``` $ docker ps | rb drop 1 | rb -l split[1] $ docker ps | perl -anE 'say $F[1] if $.>1' ``` perl solved this problem a long time ago, people
      perlperson on HN
    • for your given sample, you could use awk[0] as well ``` awk 'NR>1{print $2}' ``` or ruby[1] ``` ruby -ane 'puts $F[1] if $.>1' ``` which one to use depends on lots of factor -…
      asicsp on HN

Requests

  • Python equivalent of the tool

    From 1 comment
    • I'd love this for python as I'm not a big fan of Ruby. Does such a thing exist?
      robax on HN

Questions

  • What does this add over plain ruby -ne

    From 1 comment
    • What does this have over the default ruby? cat your-file.txt | ruby -ne '$_.your_ruby_stuff' Just syntactic sugar? (it does look cleaner!)
      meow_mix on HN

Alternatives named

  • Plain ruby -ne / -lane one-liners

    From 2 comments
    • ``` echo hello world | ruby -pe '$_.capitalize!' printf 'hello\nworld\nhello\n' | ruby -le 'puts STDIN.to_a.uniq ps | ruby -lane 'BEGIN { b = 0 }; b += $F[0].to_i; END { print…
      star-techate on HN
    • What does this have over the default ruby? cat your-file.txt | ruby -ne '$_.your_ruby_stuff' Just syntactic sugar? (it does look cleaner!)
      meow_mix on HN
  • Perl and awk one-liners

    From 2 comments
    • ``` $ docker ps | rb drop 1 | rb -l split[1] $ docker ps | perl -anE 'say $F[1] if $.>1' ``` perl solved this problem a long time ago, people
      perlperson on HN
    • for your given sample, you could use awk[0] as well ``` awk 'NR>1{print $2}' ``` or ruby[1] ``` ruby -ane 'puts $F[1] if $.>1' ``` which one to use depends on lots of factor -…
      asicsp on HN
  • Pyped and python-oneliner for Python

    From 2 comments
    • "pyped" does the same for python. I though it was great, knowing python better than bash, plus it was portable to windows. But eventually I always end up using built in GNU…
      sametmax on HN
    • Several people have tried to tackle this in Python. My attempt was python-oneliner[1]. There's also a list of similar projects in the readme. [1]…
      gvalkov on HN

Category, keywords, summaries and labels on this page were made by AI (Thread Reader v2) and not checked by hand. Each point links to the comments it came from.

Add a badge to your READMEShown on HackerShow
[![Shown on HackerShow](https://hackershow.org/badge.svg)](https://hackershow.org/show/17755199)