Last active
          June 1, 2017 05:55 
        
      - 
      
- 
        Save chew-z/0a071933c3050509b29de6960c1e1512 to your computer and use it in GitHub Desktop. 
    Script to sieve brew packages and get list of standalone and dependants
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #!/usr/bin/env zsh | |
| OLDIFS=$IFS | |
| IFS=$'\r\n' | |
| GLOBIGNORE='*' | |
| command eval 'BrewList=($(brew list))' | |
| Dependent=() | |
| Independent=() | |
| for b in "${BrewList[@]}"; do | |
| printf '.' | |
| Deps=$(brew uses --installed $b | tr '\n' ' ') | |
| if [[ -z "$Deps" ]]; then | |
| Independent+=("$b") | |
| else | |
| Dependent+=("$b : $Deps") | |
| fi | |
| done | |
| echo "\n-------------With Dependants---------------\n" | |
| printf '%s\n' "${Dependent[@]}" | |
| echo "\n-------------Standalone---------------\n" | |
| printf '%s\n' "${Independent[@]}" | |
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment