From 5db437dcd90e2fa3e48ea02927d2c68b3961a25d Mon Sep 17 00:00:00 2001 From: Razzi Abuissa Date: Tue, 22 Feb 2022 23:59:11 -0600 Subject: [PATCH] Start of pv --- bin/pv | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100755 bin/pv diff --git a/bin/pv b/bin/pv new file mode 100755 index 0000000..beb8d33 --- /dev/null +++ b/bin/pv @@ -0,0 +1,55 @@ +#!/usr/bin/env bash + +VERSION=0.0.1 + +PV_PREFIX=${PV_PREFIX-/usr/local} + +display_help() { + cat <<-EOF + +Usage: pv [option] version + +Commands: + pv Print the current python version + pv latest Download and install the latest stable python version + pv latest Download and install the latest stable python version + pv Download and install the given version. An partial + version will find the latest version matching that one. + For example \`pv 2\` will use python 2.7.18 + +Options: + --version Print the version of pv + -h, --help Print this help text + +EOF +} + +display_pv_version() { + echo $VERSION +} + +is_numeric_version() { + [[ "$1" =~ [0-3](\.[0-9]+){0,2}$ ]] +} + +install() { + local version="$1" + echo Installing $version + if is_numeric_version $1; then + echo numeric version + fi +} + +if test $# -eq 0; then + display_help + exit 0 +fi + +case $1 in + --version) display_pv_version;; + -h|--help) display_help;; + -r|--remove|remove) display_help;; + *) install $1;; +esac + + -- 2.45.2