refactor(): clean up useless versions in subcommands

pull/152/head
Joseph Werle 2 years ago
parent 1588f1edd3
commit 2148b2e06b

@ -1,12 +1,12 @@
{ {
"name": "bpkg", "name": "bpkg",
"version": "1.0.25", "version": "1.1.0",
"description": "Lightweight bash package manager", "description": "Lightweight bash package manager",
"global": true, "global": true,
"repo": "bpkg/bpkg", "repo": "bpkg/bpkg",
"install": "bash setup.sh", "install": "bash setup.sh",
"commands": { "commands": {
"lint": "command shellcheck **/*.sh", "lint": "command shellcheck **/*.sh",
"list-sources": "echo ${BPKG_SCRIPT_SOURCES[@]} | sed 's/ /\n/g'" "list-sources": "echo ${BPKG_PACKAGE_SOURCES[@]} | sed 's/ /\n/g'"
} }
} }

@ -7,7 +7,7 @@ if [[ ${BASH_SOURCE[0]} != "$0" ]]; then
fi fi
## bpkg version ## bpkg version
VERSION="1.0.25" VERSION="1.1.0"
## output error to stderr ## output error to stderr
error () { error () {

24
lib/env/env.sh vendored

@ -18,11 +18,14 @@ else
source "$(which bpkg-realpath)" source "$(which bpkg-realpath)"
fi fi
# List of bash source files
declare -a BPKG_PACKAGE_SOURCES=()
# Include config rc file if found # Include config rc file if found
BPKG_USER_CONFIG_FILE="$HOME/.bpkgrc" declare BPKG_USER_CONFIG_FILE="$HOME/.bpkgrc"
# Include config rc file if found # Include config rc file if found
BPKG_LOCAL_CONFIG_FILE="$(pwd)/.bpkgrc" declare BPKG_LOCAL_CONFIG_FILE="$(pwd)/.bpkgrc"
## meta ## meta
export BPKG_DATE="$(date)" export BPKG_DATE="$(date)"
@ -49,7 +52,7 @@ export BPKG_PACKAGE_PATH="$(bpkg_package_path)"
export BPKG_PACKAGE_ROOT="$(bpkg_realpath "$(dirname "$BPKG_PACKAGE_PATH")")" export BPKG_PACKAGE_ROOT="$(bpkg_realpath "$(dirname "$BPKG_PACKAGE_PATH")")"
export BPKG_PACKAGE_DEPS="$BPKG_PACKAGE_ROOT/deps" export BPKG_PACKAGE_DEPS="$BPKG_PACKAGE_ROOT/deps"
export BPKG_PACKAGE_VERSION="$(bpkg_package version 2>/dev/null)" export BPKG_PACKAGE_VERSION="$(bpkg_package version 2>/dev/null)"
export BPKG_PACKAGE_DESCRIPTION="$(bpkg_package description 2>/dev/null)" export BPKG_PACKAGE_DEPACKAGEION="$(bpkg_package description 2>/dev/null)"
export BPKG_PACKAGE_DEFAULT_USER="${BPKG_PACKAGE_DEFAULT_USER:-bpkg}" export BPKG_PACKAGE_DEFAULT_USER="${BPKG_PACKAGE_DEFAULT_USER:-bpkg}"
## remote ## remote
@ -59,11 +62,10 @@ export BPKG_REMOTES
export BPKG_REMOTE_RAW_PATH export BPKG_REMOTE_RAW_PATH
if test -f "$BPKG_PACKAGE_PATH"; then if test -f "$BPKG_PACKAGE_PATH"; then
declare -a BPKG_SCRIPT_SOURCES=() BPKG_PACKAGE_SOURCES+=($(find "$BPKG_PACKAGE_ROOT" -name '*.sh' 2>/dev/null))
BPKG_SCRIPT_SOURCES+=($(find "$BPKG_SCRIPT_ROOT" -name '*.sh' 2>/dev/null)) BPKG_PACKAGE_SOURCES+=($(find "$BPKG_PACKAGE_ROOT" -name '*.zsh' 2>/dev/null))
BPKG_SCRIPT_SOURCES+=($(find "$BPKG_SCRIPT_ROOT" -name '*.zsh' 2>/dev/null)) BPKG_PACKAGE_SOURCES+=($(find "$BPKG_PACKAGE_ROOT" -name '*.bash' 2>/dev/null))
BPKG_SCRIPT_SOURCES+=($(find "$BPKG_SCRIPT_ROOT" -name '*.bash' 2>/dev/null)) export BPKG_PACKAGE_SOURCES
export BPKG_SCRIPT_SOURCES
fi fi
if test -d "$BPKG_PACKAGE_DEPS/bin"; then if test -d "$BPKG_PACKAGE_DEPS/bin"; then
@ -81,10 +83,10 @@ example:
$ bpkg-env BPKG_PACKAGE* $ bpkg-env BPKG_PACKAGE*
BPKG_PACKAGE_DEPS="deps" BPKG_PACKAGE_DEPS="deps"
BPKG_PACKAGE_NAME="bpkg" BPKG_PACKAGE_NAME="bpkg"
BPKG_PACKAGE_DESCRIPTION="Lightweight bash package manager" BPKG_PACKAGE_DEPACKAGEION="Lightweight bash package manager"
BPKG_PACKAGE_REPO="bpkg/bpkg" BPKG_PACKAGE_REPO="bpkg/bpkg"
BPKG_PACKAGE_USER="bpkg" BPKG_PACKAGE_USER="bpkg"
BPKG_PACKAGE_VERSION="1.0.7" BPKG_PACKAGE_VERSION="1.1.0"
USAGE USAGE
} }
@ -117,7 +119,7 @@ bpkg_env () {
{ {
printenv printenv
echo BPKG_SCRIPT_SOURCES=\""${BPKG_SCRIPT_SOURCES[*]}"\" echo BPKG_PACKAGE_SOURCES=\""${BPKG_PACKAGE_SOURCES[*]}"\"
} | \ } | \
grep '^\s*BPKG_' | \ grep '^\s*BPKG_' | \
sed 's/^\s*//g' | \ sed 's/^\s*//g' | \

@ -258,8 +258,6 @@ bpkg_install () {
## 1: the package was not found on the remote ## 1: the package was not found on the remote
## 2: a fatal error occurred ## 2: a fatal error occurred
bpkg_install_from_remote () { bpkg_install_from_remote () {
local cwd
local pkg=$1 local pkg=$1
local remote=$2 local remote=$2
local git_remote=$3 local git_remote=$3
@ -282,8 +280,6 @@ bpkg_install_from_remote () {
declare -a scripts=() declare -a scripts=()
declare -a files=() declare -a files=()
cwd=$(pwd)
## get version if available ## get version if available
{ {
OLDIFS="$IFS" OLDIFS="$IFS"

@ -1,7 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
VERSION="0.0.1"
if ! type -f bpkg-utils &>/dev/null; then if ! type -f bpkg-utils &>/dev/null; then
echo "error: bpkg-utils not found, aborting" echo "error: bpkg-utils not found, aborting"
exit 1 exit 1
@ -13,13 +11,12 @@ fi
bpkg_initrc bpkg_initrc
usage () { usage () {
echo "bpkg-list [-h|--help] [-V|--version] [-d|--details]" echo "bpkg-list [-h|--help] [-d|--details]"
echo echo
echo "List all known bash packages from the repo. You first must run \`bpkg update' to sync the repo locally." echo "List all known bash packages from the repo. You first must run \`bpkg update' to sync the repo locally."
echo "Options:" echo "Options:"
echo " --help|-h Print this help dialogue" echo " --help|-h Print this help dialogue"
echo " --version|-V Print version and exit"
echo " --details|-d More verbose output" echo " --details|-d More verbose output"
} }
@ -27,10 +24,6 @@ bpkg_list () {
local verbose=0 local verbose=0
for opt in "${@}"; do for opt in "${@}"; do
case "$opt" in case "$opt" in
-V|--version)
echo "${VERSION}"
return 0
;;
-h|--help) -h|--help)
usage usage
return 0 return 0

@ -1,7 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
VERSION="0.1.0"
if ! type -f bpkg-utils &>/dev/null; then if ! type -f bpkg-utils &>/dev/null; then
echo "error: bpkg-utils not found, aborting" echo "error: bpkg-utils not found, aborting"
exit 1 exit 1
@ -27,7 +25,7 @@ usage () {
echo "$mesg" echo "$mesg"
echo echo
fi fi
echo "bpkg-show [-Vh]" echo "bpkg-show [-h|--help]"
echo "bpkg-show <user/package_name>" echo "bpkg-show <user/package_name>"
echo "bpkg-show readme <user/package_name>" echo "bpkg-show readme <user/package_name>"
echo "bpkg-show sources <user/package_name>" echo "bpkg-show sources <user/package_name>"
@ -40,8 +38,7 @@ usage () {
echo " order. This option suppresses other output and prints executable bash." echo " order. This option suppresses other output and prints executable bash."
echo echo
echo "Options:" echo "Options:"
echo " --help|-h Print this help dialogue" echo " -h,--help Print this help dialogue"
echo " --version|-V Print version and exit"
} }
show_package () { show_package () {
@ -137,10 +134,6 @@ bpkg_show () {
local pkg="" local pkg=""
for opt in "$@"; do for opt in "$@"; do
case "$opt" in case "$opt" in
-V|--version)
echo "${VERSION}"
return 0
;;
-h|--help) -h|--help)
usage usage
return 0 return 0

@ -1,8 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
## version
VERSION="0.0.1"
## coords ## coords
(( _x=0 )) (( _x=0 ))
(( _y=0 )) (( _y=0 ))
@ -183,11 +180,6 @@ term () {
case "${arg}" in case "${arg}" in
## flags ## flags
-V|--version)
echo "${VERSION}"
return 0
;;
-h|--help) -h|--help)
usage usage

@ -1,7 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
VERSION="0.0.1"
if ! type -f bpkg-utils &>/dev/null; then if ! type -f bpkg-utils &>/dev/null; then
echo "error: bpkg-utils not found, aborting" echo "error: bpkg-utils not found, aborting"
exit 1 exit 1
@ -49,10 +47,6 @@ bpkg_update_remote() {
bpkg_update () { bpkg_update () {
for opt in "${@}"; do for opt in "${@}"; do
case "$opt" in case "$opt" in
-V|--version)
echo "${VERSION}"
return 0
;;
-h|--help) -h|--help)
usage usage
return 0 return 0

Loading…
Cancel
Save