Remove environment variable support
This commit is contained in:
parent
07d9734ba0
commit
02adb8dd79
30
cv
30
cv
@ -1,25 +1,30 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Variable declarations go here.
|
||||||
w=11
|
w=11
|
||||||
dfmt="+%Y-%m-%d"
|
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(){
|
ex(){
|
||||||
echo -e "> ${*}"
|
echo -e "> ${*}"
|
||||||
$@
|
$@
|
||||||
}
|
}
|
||||||
[ -z $date ] && date=$(date $dfmt)
|
|
||||||
[ -z $ydate ] && ydate=$(date -d yesterday $dfmt)
|
|
||||||
title(){
|
title(){
|
||||||
local w=39
|
local w=39
|
||||||
printf "║ %-${w}s ║\n" "${*}"
|
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(){
|
get(){
|
||||||
if [ -f "$data/$date-$country" ]
|
if [ -f "$data/$date-$country" ]
|
||||||
then
|
then
|
||||||
@ -95,15 +100,6 @@ result(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Main code starts here.
|
# 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" ]
|
if [ ! -z "$country" ]
|
||||||
then
|
then
|
||||||
endpoint=countries/$country
|
endpoint=countries/$country
|
||||||
|
Reference in New Issue
Block a user