Commit 85b16f56 authored by Aral Balkan's avatar Aral Balkan

Added better/list command.

parent 9d00db98
Pipeline #479 skipped
#!/bin/sh
################################################################################
#
# Better command: list
#
# Usage: list [trackers|sites]
# list [<trackers|sites> domain]
#
# Lists the current list of trackers, sites, or all draft info, ordered
# by importance (# trackers for sites, tracker popularity for trackers).
#
# If a domain is provided, then the list starts with that domain.
#
# This is Independent Technology.
#
# ▲❤ We practice Ethical Design (https://ind.ie/ethical-design)
#
# © Aral Balkan. © Ind.ie. All Rights Reserved.
# Released with love by Ind.ie under GNU AGPLv3 or later.
# Free as in freedom. Please see the LICENSE file.
#
################################################################################
################################################################################
#
# Private functions
#
################################################################################
#
# Runs command in requested directory and restores the working directory at the end.
# Usage: run <directory> "<command>"
#
runIn(){
pushd $1 >/dev/null
eval $2
popd >/dev/null
}
showUsage(){
echo "Usage: list [trackers|sites] or list [<trackers|sites> domain]"
}
if [ -n "$2" ]; then
if [[ "$1" = "trackers" || "$1" = "sites" ]]; then
runIn inspector "coffee stats.coffee --$1 --start=$2 --count=20"
fi
elif [ "$1" = "trackers" ]; then
runIn inspector "coffee stats.coffee --trackers --count=20"
elif [ "$1" = "sites" ]; then
runIn inspector "coffee stats.coffee --sites --count=20"
else
runIn inspector "coffee stats.coffee"
fi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment