echo-e"[INFO] For help, please run '${GREEN}ebulk --help${NC}'"
echo-e"[INFO] For README, please run '${GREEN}ebulk --readme${NC}'"
echo
}
function checkParameters {
if[!-f$TEMPLATE_FILE];then
echo
echo-e"${ORANGE}[ERROR] File '$TEMPLATE_FILE' not found!${NC}">&2;return 1
fi
if[-z"$DATASET_DIR"];then
echo
echo-e"${ORANGE}[ERROR] Dataset path not specified."
echo-e"[INFO] Please specify a valid dataset path.${NC}"
echo
helpReadme >&2;return 1
fi
if["$STORAGE"=""];then
if[!-d$DATASET_DIR];then
echo
mkdir$DATASET_DIR 2>/dev/null
if[!$?-eq 0 ];then
echo
echo-e"${ORANGE}[ERROR] Dataset path not found."
echo-e"[INFO] Please specify a valid dataset path.${NC}"
echo
helpReadme >&2;return 1
fi
fi
EBULK_DATASET_FILE="$DATASET_DIR/.ebulk_dataset"
if[[$DATASET_DIR!=$REFERENCE]];then
DATA_SET=$REFERENCE
echo$REFERENCE>$EBULK_DATASET_FILE 2>/dev/null
else
if[-f$EBULK_DATASET_FILE];then
DATA_SET=$(cat"$DATASET_DIR/.ebulk_dataset")
else
DATA_SET=$(basename"$DATASET_DIR")
echo$DATA_SET>$EBULK_DATASET_FILE 2>/dev/null
fi
fi
else
DATA_SET=$DATASET_DIR
fi
re='^[A-Za-z][_A-Za-z.0-9-]*$'
if![[$DATA_SET=~ $re]];then
echo
echo-e"${ORANGE}[ERROR] Error in argument: invalid dataset name ${GREEN}'$DATA_SET'${ORANGE}.${NC}"
echo-e"${ORANGE}[ERROR] Dataset name must start with a letter, and only alphanumerics, dots ( . ), underscores ( _ ) and hyphens ( - ) are allowed.${NC}"
echo
if[-f$EBULK_DATASET_FILE];then
rm-f${EBULK_DATASET_FILE}
fi
helpReadme >&2;return 1
fi
if[!-z"$CHUNK"];then
re='^[0-9]+$'
if![[$CHUNK=~ $re]];then
echo
echo-e"${ORANGE}[ERROR] Error in argument: chunk size must be an integer.${NC}"
echo
helpReadme >&2;return 1
fi
fi
}
function askCredentials {
echo
echo"Please, enter your ebulk user and password:"
echo
echo"** You can use the same Telecom-Wendelin-IA site user and password **"
echo"** If you don't have a user, please feel free to request one to roqueporchetto@gmail.com **"
echo
echo"User:"
read-e USER
re='^[A-Za-z][-A-Za-z0-9_]*$'
if![[$USER=~ $re]];then
echo
echo-e"${ORANGE}[ERROR] Invalid user name. Did enter an invalid character?"
echo-e"[INFO] Please enter a valid user name.${NC}"
echo>&2;return 1
fi
PASS=read-s-e-p Password: pwd
}
function updateConfigFile {
if["$STORAGE"!=""];then
echo
echo"** You have chosen $STORAGE storage, please enter the information needed to configure it **"
echo
OPTION=""
if["$ADVANCED"=true];then
echo"[INFO] If you want to edit the configuration file by yourself (advanced) please type CONFIG, otherwise press enter to continue."
read-e OPTION
if["$OPTION"="CONFIG"];then
CUSTOM=true
fi
fi
if["$OPTION"!="CONFIG"];then
$PARAMETER_FUNCTION
if["$ADVANCED"=false];then
echo"** If you need a more advanced storage configuration, you can run the tool with the parameter --advanced **"
spec.summary="Input/output plugin for ingestion/download of datasets to/from wendelin"
spec.description="Loads records from fif files in local storage and send them to wendelin via http. Loads records from wendelin via http and store them locally."
spec.email=["roqueporchetto@gmail.com"]
spec.licenses=["MIT"]
# TODO set this: spec.homepage = "https://github.com/roqueporchetto/embulk-wendelin-dataset-tool"