diff --git a/.gitignore b/.gitignore index 480dcf6..8ba2b63 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ +#user application folders raw/ +data/ diff --git a/add b/add new file mode 100755 index 0000000..28484fe --- /dev/null +++ b/add @@ -0,0 +1,18 @@ +#!/bin/bash + +# Copyright (C) 2020 - Hesham Banafa +# 20 Aug 2020 - H.B. + +#Add a stock to protfolio +if (($# != 5)); then + echo "Usage: add \"\" " + exit 1 +fi +mkdir -p data +json=$(echo "{\"code\": $1, \"name\": \"$2\", \"cost\": $3, \"quantity\": $4, \"current\": $5}" | jq .) +if [ -n "$json" ]; then + echo $json | jq . > data/$1.json +else + exit 1 +fi +exit 0