mirror of
https://github.com/iv-org/youtube-utils.git
synced 2025-08-09 23:32:28 -04:00
Fix: -c/--client is required even with -d/--data
(required to get the proper API key)
This commit is contained in:
parent
a9c62a7121
commit
653a1611c2
1 changed files with 9 additions and 6 deletions
|
@ -5,14 +5,16 @@
|
||||||
print_help()
|
print_help()
|
||||||
{
|
{
|
||||||
echo "Usage: yt-api-helper -i [-c <client>] [-e <endpoint>]"
|
echo "Usage: yt-api-helper -i [-c <client>] [-e <endpoint>]"
|
||||||
echo "Usage: yt-api-helper -e <endpoint> -d <data>"
|
echo "Usage: yt-api-helper -c <client> -e <endpoint> -d <data>"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Options:"
|
echo "Options:"
|
||||||
echo " -c,--client Client to use. Pass 'help' to this option to get"
|
echo " -c,--client Client to use. Pass 'help' to this option to get"
|
||||||
echo " the list of supported clients"
|
echo " the list of supported clients. Mandatory in"
|
||||||
|
echo " non-interactive mode."
|
||||||
echo " -d,--data Raw data to send to the API"
|
echo " -d,--data Raw data to send to the API"
|
||||||
echo " -e,--endpoint Youtube endpoint to request. Pass 'help' to this"
|
echo " -e,--endpoint Youtube endpoint to request. Pass 'help' to this"
|
||||||
echo " option to get the list of supported endpoints"
|
echo " option to get the list of supported endpoints."
|
||||||
|
echo " Mandatory in non-interactive mode"
|
||||||
echo " -h,--help Show this help"
|
echo " -h,--help Show this help"
|
||||||
echo " -i,--interactive Run in interactive mode"
|
echo " -i,--interactive Run in interactive mode"
|
||||||
echo " -o,--output Print output to file instead of stdout"
|
echo " -o,--output Print output to file instead of stdout"
|
||||||
|
@ -197,9 +199,10 @@ if [ ! -z "$data" ]; then
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Can't pass client in non-interactive mode (must be part of data)
|
# In non-interactive mode, we still need to pass a client
|
||||||
if [ ! -z "$client_option" ]; then
|
# so the right API key is passed as a URL parameter
|
||||||
echo "Error: -c/--client can't be used with -d/--data"
|
if [ -z "$client_option" ]; then
|
||||||
|
echo "Error: -c/--client is required to select an API key"
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue