Skip to content

Instantly share code, notes, and snippets.

@AlvaroBrey
Created November 21, 2017 09:49
Show Gist options
  • Save AlvaroBrey/9bc32706193e4e571a97e8acec2d75c4 to your computer and use it in GitHub Desktop.
Save AlvaroBrey/9bc32706193e4e571a97e8acec2d75c4 to your computer and use it in GitHub Desktop.
Wrapper for pidcat(https://github.com/JakeWharton/pidcat) that uses fzf (https://github.com/junegunn/fzf) to search for the app to log
#!/usr/bin/env bash
PACKAGE=$(adb shell pm list packages -3 | cut -d ':' -f 2 | sort \
| fzf --reverse \
--preview-window right:40% \
--preview "echo {} | xargs -I % curl -s -o- \"https://play.google.com/store/apps/details?id=%\" | grep -oh '<div class=\"id-app-title\" tabindex=\"0\">[^<]*</div>' | sed -r -n 's/^<.*>(.*)<.*>$/\1/p'" \
)
if [[ ! -z "$PACKAGE" ]]; then
pidcat "$PACKAGE"
else
echo "No package selected"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment