gradio/scripts/helpers.sh
Artin Mohammadi bdced314bc
Scripts become much easier to read and understand (#1918)
* Being nice to the user

* Front-end builder, CircleCI runner, and Gradio installer updated

* The testing scripts updated

* Front-end runner and the website launcher updated

* The formatters updated

* GitHub Actions and PyPI uploader scripts updated

* Updating the URLs

* Removing commented codes

* Delete a blank line
2022-08-01 15:17:03 -07:00

86 lines
2.0 KiB
Bash

#!/bin/bash
#######################################
# Tell the user what programs to install for a specific task.
# Arguments:
# Name of the program or actual command, a string.
# External link for easier installation help.
# Outputs:
# Prints the required program name and the external link (if given).
#######################################
function program_required() {
if [ ! -x "$(command -v ${1})" ]; then
echo "${1} is not installed in the computer..."
if [ "${2}" ]; then
echo "Check out this link: ${2}"
fi
exit 1
fi
}
#######################################
# Check for the PIP program.
# Arguments:
# None
# Outputs:
# None
#######################################
function pip_required() {
program_required "pip" "https://pip.pypa.io/en/stable/installation/"
}
#######################################
# Check for the NPM program.
# Arguments:
# None
# Outputs:
# None
#######################################
function npm_required() {
program_required "npm" "https://nodejs.org/en/download/"
}
#######################################
# Check for the PNPM program.
# Arguments:
# None
# Outputs:
# None
#######################################
function pnpm_required() {
program_required "pnpm" "https://pnpm.io/6.x/installation"
}
#######################################
# Check for the CircleCI program.
# Arguments:
# None
# Outputs:
# None
#######################################
function circleci_required() {
program_required "circleci" "https://circleci.com/docs/1.0/local-cli/"
}
#######################################
# Check for the AWS CLI program.
# Arguments:
# None
# Outputs:
# None
#######################################
function aws_required() {
program_required "aws" "https://aws.amazon.com/cli/"
}
#######################################
# Check for the Git program.
# Arguments:
# None
# Outputs:
# None
#######################################
function git_required() {
program_required "git" "https://git-scm.com/downloads"
}