gradio/scripts/helpers.sh
Abubakar Abid e5fd99c79b
Update CONTRIBUTING.md (#2118)
* Update CONTRIBUTING.md

* Update helpers.sh
2022-08-30 07:42:44 -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/7.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"
}