aboutsummaryrefslogtreecommitdiff
path: root/bin/ak-categories
diff options
context:
space:
mode:
Diffstat (limited to 'bin/ak-categories')
-rwxr-xr-xbin/ak-categories19
1 files changed, 10 insertions, 9 deletions
diff --git a/bin/ak-categories b/bin/ak-categories
index e50e1fc..292e789 100755
--- a/bin/ak-categories
+++ b/bin/ak-categories
@@ -2,13 +2,14 @@
AK_CATEGORIES="$AK_WORKDIR/categories"
PROGRAM="$(basename $0)"
-echo $AK_CATEGORIES
+source $AK_LIBDIR/_ak_logit
+
if [ ! -d $AK_CATEGORIES ]; then
mkdir $AK_CATEGORIES
cd $AK_CATEGORIES
- echo "AK_CATEGORIES created"
+ logit "INFO" "AK_CATEGORIES created"
else
- echo "AK_CATEGORIES found"
+ logit "INFO" "AK_CATEGORIES found"
fi
_ak_modules_categories_create(){
@@ -16,7 +17,7 @@ _ak_modules_categories_create(){
cd $TEMP
export NEWS_FILE="$(date +%Y%m%d_%H%M%S)"
vi $NEWS_FILE
- echo "Renaming..."
+ logit "INFO" "Renaming..."
TITLE="$(head -n 1 $NEWS_FILE)"
TO_FILE=$NEWS_FILE-$(echo $TITLE | tr '[:upper:]' '[:lower:]' | sed -e 's/ /\_/g' )
IPFS_FILE=$(ak-ipfs-add $NEWS_FILE)
@@ -46,10 +47,10 @@ _ak_modules_categories_import(){
then
if [ ! -d $1 ]
then
- echo "Folder does not exists"
+ logit "ERROR" "Folder does not exists"
exit 4
else
- echo "Folder $1 exists"
+ logit "INFO" "Folder $1 exists"
fl="$(ls -1 $1)"
for f in $fl
do
@@ -57,7 +58,7 @@ _ak_modules_categories_import(){
done
fi
else
- echo "No value"
+ logit "ERROR" "No value"
exit 6
fi
exit 224
@@ -67,7 +68,7 @@ _ak_modules_categories_add(){
cd $TEMP
if [ -f $1 ]; then
FILE="$1"
- echo "Adding news from " $FILE
+ logit "INFO" "Adding news from " $FILE
DATETIME=$(echo $FILE | cut -d - -f 1 | awk '{print $1}')
TITLE=$(head -n 1 $FILE)
FILE_IPFS_HASH=$(ak-ipfs-add $FILE)
@@ -105,7 +106,7 @@ _ak_modules_categories_usage(){
echo " newsletter and it's going to be saved"
exit 0
}
-_ak_modules_categories_title
+
if [ ! -z $1 ]; then
case $1 in
-h | --help) _ak_modules_categories_usage; exit;;