Skip to content

Commit 2335074

Browse files
committed
integrate Glue (sort of)
1 parent 770d6e7 commit 2335074

File tree

9 files changed

+78
-6
lines changed

9 files changed

+78
-6
lines changed

bpm.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
binDirs = 'pkg/bin'

glue-auto.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
glueVersion = '56c3928cd823a0ebb7aae7740cb24497d60cb677'
2+
3+
storeVersion = ''
4+
5+
programVersion = ''

glue.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
using = ['Bash']
2+
3+
name = ''
4+
email = ''
5+
project = ''
6+
description = ''
7+
license = ''

pkg/bin/choose

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#!/usr/bin/env bash
2+
# AUTOGENERATED by the 'task-Bash-generate-bins.sh' Glue action!
3+
# Do NOT edit!
4+
5+
# https://github.com/bashup/realpaths
6+
realpath.location() {
7+
realpath.follow "$1"
8+
realpath.absolute "$REPLY" ".."
9+
}
10+
11+
realpath.dirname() {
12+
REPLY=.
13+
! [[ $1 =~ /+[^/]+/*$|^//$ ]] || REPLY="${1%${BASH_REMATCH[0]}}"
14+
REPLY=${REPLY:-/}
15+
}
16+
17+
realpath.follow() {
18+
local target
19+
while [[ -L "$1" ]] && target=$(readlink -- "$1"); do
20+
realpath.dirname "$1"
21+
# Resolve relative to symlink's directory
22+
[[ $REPLY != . && $target != /* ]] && REPLY=$REPLY/$target || REPLY=$target
23+
# Break out if we found a symlink loop
24+
for target; do [[ $REPLY == "$target" ]] && break 2; done
25+
# Add to the loop-detect list and tail-recurse
26+
set -- "$REPLY" "$@"
27+
done
28+
REPLY="$1"
29+
}
30+
31+
realpath.absolute() {
32+
REPLY=$PWD; local eg=extglob; ! shopt -q $eg || eg=; ${eg:+shopt -s $eg}
33+
while (($#)); do case $1 in
34+
//|//[^/]*) REPLY=//; set -- "${1:2}" "${@:2}" ;;
35+
/*) REPLY=/; set -- "${1##+(/)}" "${@:2}" ;;
36+
*/*) set -- "${1%%/*}" "${1##${1%%/*}+(/)}" "${@:2}" ;;
37+
''|.) shift ;;
38+
..) realpath.dirname "$REPLY"; shift ;;
39+
*) REPLY="${REPLY%/}/$1"; shift ;;
40+
esac; done; ${eg:+shopt -u $eg}
41+
}
42+
43+
44+
# Get the path to the 'lib' directory, which could be different depending on
45+
# the method of installation. If the user installed the program through their
46+
# distribution's package manager, the 'lib' files are in an extra subfolder
47+
# compared to an installation through Git (ex. Basher)
48+
realpath.location "${BASH_SOURCE[0]}"
49+
REPLY="${REPLY/%\/}"
50+
REPLY="${REPLY%/*}"
51+
if [ -d "$REPLY/lib/glue" ]; then
52+
PROGRAM_LIB_DIR="$REPLY/lib/choose"
53+
elif [ -d "$REPLY/lib" ]; then
54+
PROGRAM_LIB_DIR="$REPLY/lib"
55+
else
56+
echo "Error: Could not determine \$PROGRAM_LIB_DIR"
57+
exit 1
58+
fi
59+
60+
# shellcheck disable=SC1091
61+
source "$PROGRAM_LIB_DIR/cmd/choose.sh"

choose.sh renamed to pkg/lib/cmd/choose.sh

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@
33
# async issues with +u when sourcing
44
set -Eo pipefail
55

6-
DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
7-
86
# ------------------------- start ------------------------ #
9-
source "$DIR/lib/do.sh"
10-
source "$DIR/lib/helper.sh"
11-
source "$DIR/lib/plumbing.sh"
12-
source "$DIR/lib/util.sh"
7+
source "$PROGRAM_LIB_DIR/do.sh"
8+
source "$PROGRAM_LIB_DIR/helper.sh"
9+
source "$PROGRAM_LIB_DIR/plumbing.sh"
10+
source "$PROGRAM_LIB_DIR/util.sh"
1311

1412
dbDir="${CHOOSE_DB_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/choose/db}"
1513

lib/do.sh renamed to pkg/lib/do.sh

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)