Remove environment variable support
This commit is contained in:
parent
07d9734ba0
commit
02adb8dd79
30
cv
30
cv
|
@ -1,25 +1,30 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Variable declarations go here.
|
||||
w=11
|
||||
dfmt="+%Y-%m-%d"
|
||||
data="$HOME/Documents/cv"
|
||||
[ ! -d "$data" ] && ex "mkdir -p $data"
|
||||
[ -z $date ] && date=$(date $dfmt)
|
||||
[ -z $ydate ] && ydate=$(date -d yesterday $dfmt)
|
||||
|
||||
# Get yesterday's stats for queries after midnight.
|
||||
if [ "$2" == "yesterday" ]
|
||||
then
|
||||
date=$(date -d yesterday $dfmt)
|
||||
ydate=$(date -d "2 days ago" $dfmt)
|
||||
fi
|
||||
|
||||
# Functions go here.
|
||||
ex(){
|
||||
echo -e "> ${*}"
|
||||
$@
|
||||
}
|
||||
[ -z $date ] && date=$(date $dfmt)
|
||||
[ -z $ydate ] && ydate=$(date -d yesterday $dfmt)
|
||||
title(){
|
||||
local w=39
|
||||
printf "║ %-${w}s ║\n" "${*}"
|
||||
}
|
||||
|
||||
data="$HOME/Documents/cv"
|
||||
[ ! -d "$data" ] && ex "mkdir -p $data"
|
||||
|
||||
# If not set by an environment variable, set country to $1.
|
||||
[ -z "$country" ] && country=$1
|
||||
|
||||
get(){
|
||||
if [ -f "$data/$date-$country" ]
|
||||
then
|
||||
|
@ -95,15 +100,6 @@ result(){
|
|||
}
|
||||
|
||||
# Main code starts here.
|
||||
|
||||
# Get yesterday's stats for queries after midnight.
|
||||
# Not pretty but it works I guess...
|
||||
if [ "$2" == "yesterday" ]
|
||||
then
|
||||
date=$(date -d yesterday $dfmt)
|
||||
ydate=$(date -d "2 days ago" $dfmt)
|
||||
fi
|
||||
|
||||
if [ ! -z "$country" ]
|
||||
then
|
||||
endpoint=countries/$country
|
||||
|
|
Reference in New Issue