Skip to content

Commit

Permalink
Merge pull request #301 from iAGorynT/iAGorynT-Code-Snippet-Changes
Browse files Browse the repository at this point in the history
New Brewapps Listing
  • Loading branch information
iAGorynT authored May 12, 2024
2 parents 533b193 + a7a3e0e commit 127002e
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
31 changes: 31 additions & 0 deletions ShellScripts/Brewapps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/zsh

# List Selected Application Descriptions
clear
echo "App Descriptions..."
echo " "

# Array of app names
apps=("btop" "iperf3" "jq" "qlmarkdown" "macdown" "mosh" "speedtest" "balenaetcher" "github" "macvim")

# Function to check if a line contains an app name
contains_app() {
local line=$1
for app in "${apps[@]}"; do
if [[ $line == *"$app"* ]]; then
echo "$line"
break
fi
done
}

# Temporary file to store brew command results
temp_file=$(mktemp)
# Run the command and store output in a temporary file
brew desc --eval-all $(brew list) | awk 'gsub(/^([^:]*?)\s*:\s*/,"&=")' | column -s "=" -t > $temp_file

# Read file line by line and check for app names
while IFS= read -r line; do
contains_app "$line"
done < $temp_file

4 changes: 2 additions & 2 deletions ShellScripts/Brewm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ function viewbrewfile {
cat ~/Brewfile
echo -en "\n\n\t\t\tHit any key to view App Descriptions"
read -k 1 line
# Display Installed Brew File App Descriptions
# Display Selected Brew File App Descriptions
clear
echo "App Descriptions..."
echo " "
cat ~/Brewapps
brewapps.sh
}

function brewapps {
Expand Down

0 comments on commit 127002e

Please sign in to comment.