Add function to get the content type (file, url,…)

This commit is contained in:
Jeremy Gardais 2020-03-12 07:51:48 +01:00
parent 026ec0f1aa
commit fef976bfec
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 19 additions and 0 deletions

View File

@ -31,6 +31,22 @@ debug_message() {
[ "${debug}" = "true" ] && printf "${c_magentab}%-6b${c_reset}\n" "DEBUG ${_message}"
}
# ]]]
# Function to get content type [[[
determine_content_type() {
_content="${1}"
_content_nb_line=$(printf -- '%s\n' "${_content}" | wc -l)
debug_message " Determine type: Content has ${_content_nb_line} line(s) to send."
## If it's a one line content
if [ "${_content_nb_line}" -eq "1" ]; then
### Verify if it's a path to a existent file
flag_file=""
### Verify it it's a remote URL
flag_url=""
fi
}
# ]]]
# Verify argument [[[
case "$#" in
@ -62,6 +78,9 @@ fi
debug_message " Get Content: content to be sended: ${content_to_send}"
# ]]]
# Try to determine the type of the content (file, remote URL or text)
determine_content_type "${content_to_send}"
content_url=""
# Manage the result [[[