Skip to content
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

info: add requires_sudo? and --machine-readable #8819

Closed
wants to merge 1 commit into from

Conversation

phinze
Copy link
Contributor

@phinze phinze commented Jan 11, 2015

  • requires_sudo reports whether we can detect that the cask
    install will need sudo privileges
  • the --machine-readable option for brew cask info changes the
    output format to JSON, which is more suitable for parsing from
    external tools

I didn't attempt to include artifact details in the JSON output just
yet, since the first goal of this feature is just to tell
puppet-brewcask (in boxen) whether it need sudo for a given Cask.

refs #8817

 - requires_sudo reports whether we can detect that the cask
   install will need sudo privileges
 - the --machine-readable option for `brew cask info` changes the
   output format to JSON, which is more suitable for parsing from
   external tools

I didn't attempt to include artifact details in the JSON output just
yet, since the first goal of this feature is just to tell
puppet-brewcask (in boxen) whether it need sudo for a given Cask.

refs #8817
@vitorgalvao
Copy link
Member

A note on --machine-readable: @rolandwalker commented on us not having any pseudo-verbs starting with -- as being a good thing. This would break that streak.

@phinze
Copy link
Contributor Author

phinze commented Jan 11, 2015

Oh hey - thanks for the pointer to that conversation; I had missed it.

Unlike the linked example, to me this does feel like more of a true modifier to the info verb than new pseudo-verb. It's the same data, just formatted differently. Like I could see the flag just as easily being called --format={text,json} (an option defaulting to text).

Does it strike you more as something needing a fresh top-level verb?

@radeksimko
Copy link
Contributor

Like I could see the flag just as easily being called --format={text,json} (an option defaulting to text).

👍 I was thinking that json may not be the best format if/when people start parsing it with standard shell tools like grep, awk etc. Nonetheless it will obviously do the job for puppet-brewcask as we can parse JSON in Ruby there.

@vitorgalvao
Copy link
Member

Does it strike you more as something needing a fresh top-level verb?

Not necessarily. I linked to it because it seemed relevant to the conversation, but I have no strong opinion on the subject either way.

I was thinking that json may not be the best format if/when people start parsing it with standard shell tools like grep, awk etc.

Agreed.

@phinze
Copy link
Contributor Author

phinze commented Jan 11, 2015

I was thinking that json may not be the best format if/when people start parsing it with standard shell tools like grep, awk etc.

I hear you there, and I did give it some thought before deciding on JSON. The trouble is that there's not really a standard "awk-friendly" data format, whereas JSON is becoming more and more widely used for data transport between tools. Personally I've found in the last year or so jq has become indispensable for day-to-day unix piping needs.

All that being said, I see there could be a good case for us to add an additional awk/grep friendly output format - so how about I make room for that possibility by switching to the --format=json arg style?

@radeksimko
Copy link
Contributor

so how about I make room for that possibility by switching to the --format=json arg style?

👍

@radeksimko
Copy link
Contributor

Regarding the "awk-friendly" data format, I think we could be inspired by vagrant:
https://github.com/mitchellh/vagrant/blob/5e6b2bc55b873e2fb17ea115911c7717f2efa968/lib/vagrant/ui.rb#L72-106

@rolandwalker rolandwalker added the core Issue with Homebrew itself rather than with a specific cask. label Jan 13, 2015
@rolandwalker
Copy link
Contributor

+1. JSON support is a great thing, even if we support other formats later.

The default text format of info could use some love, too.

@blardo
Copy link

blardo commented Jan 29, 2015

👍 Working with Boxen to install Vagrant and VirtualBox runs into this same issue. This work is foundational in making that integration smoother. Excited for when this hits.

@tamasflamich
Copy link

Thank you for this. Adding --machine-readable would be a welcome change for me as well. May I suggest to include the version of the formula in the JSON too?

@sebroeder
Copy link
Contributor

Is there anything we can do to get this PR completed/merged? Asking for a Boxen user 😆

@phinze
Copy link
Contributor Author

phinze commented Nov 16, 2015

Anyone else is welcome to pick this up. For now - closing it to reduce noise on the repo.

@phinze phinze closed this Nov 16, 2015
@phinze phinze deleted the info-machine-readable-requires-sudo branch November 16, 2015 22:29
@miccal miccal removed core Issue with Homebrew itself rather than with a specific cask. enhancement labels Dec 23, 2016
@Homebrew Homebrew locked and limited conversation to collaborators May 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants