homebrew-createzap icon indicating copy to clipboard operation
homebrew-createzap copied to clipboard

Output %w[ord] array

Open danielbayley opened this issue 2 years ago • 5 comments

Cleaner syntax, and now brew style compliant.

danielbayley avatar Feb 23 '22 17:02 danielbayley

Why do we need to output %w?

nrlquaker avatar Feb 23 '22 17:02 nrlquaker

Why do we need to output %w?

Cleaner syntax, and now brew style compliant.

Easier to use a word array when working with a large array of long strings, like when having to add more entries that createzap missed… createzap is a useful starting point, but doesn't always find everything…

zap trash: [
  "~/Library/Application Support/Flux",
  "~/Library/Caches/org.herf.Flux",
  "~/Library/Containers/com.justgetflux.flux",
  "~/Library/Cookies/org.herf.Flux.binarycookies",
  "~/Library/Preferences/org.herf.Flux.plist",
]

vs

zap trash: %w[
  ~/Library/Application Support/Flux
  ~/Library/Caches/org.herf.Flux
  ~/Library/Containers/com.justgetflux.flux
  ~/Library/Cookies/org.herf.Flux.binarycookies
  ~/Library/Preferences/org.herf.Flux.plist
]

danielbayley avatar Feb 23 '22 18:02 danielbayley

@danielbayley Sorry for a delay. But I still don't understand why we should output zap trash: %w[ is zap stanza. I couldn't found any reference to it in documentation. Can you explain please?

nrlquaker avatar Apr 07 '22 13:04 nrlquaker

@danielbayley Sorry for a delay. But I still don't understand why we should output zap trash: %w[ is zap stanza. I couldn't found any reference to it in documentation. Can you explain please?

More info on array literals here

I suppose it’s personal preference… The brew style Rubocop doesn’t enforce either style, so up to you really @nrlquaker. I use the latter in my taps, as it’s easier to edit.

danielbayley avatar Jun 04 '22 10:06 danielbayley

I want this script to create stanza with the same style as in main repo. I don't see any array literals there

nrlquaker avatar Jun 05 '22 13:06 nrlquaker

I want this script to create stanza with the same style as in main repo. I don't see any array literals there

Fair enough 👌🏼

danielbayley avatar Aug 25 '22 23:08 danielbayley