Skip to content

Commit

Permalink
Issue #131: Source completions for SCL git
Browse files Browse the repository at this point in the history
Signed-off-by: Mike Detwiler <mike@detwiler.io>
  • Loading branch information
detwiler committed Dec 15, 2022
1 parent f8d398c commit 26bf414
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
24 changes: 13 additions & 11 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -101,17 +101,6 @@ AM_COND_IF([HAVE_BASH_PATH],
[MULTI_BASH_HACK=data/bash/common/single-bash.sh])
AC_SUBST_FILE([MULTI_BASH_HACK])

QH_ARG_ENABLE([scl], [no])
AM_CONDITIONAL([ENABLE_SCL], [test "x$enable_scl" = xyes])
AM_COND_IF([ENABLE_SCL],
[QH_REQUIRE_PROG([SCL], [scl], [path to scl])
QH_REQUIRE_PROG([SCL_ENABLED], [scl_enabled], [path to scl_enabled])
QH_REQUIRE_PROG([SCL_SOURCE], [scl_source], [path to scl_source])
QH_VAR_ENSURE([SCL_LIST],
[software collections list],
[`$SCL --list`])
AC_CONFIG_FILES([data/bash/common/profile.d/scl.sh])])

# bash-completion not enabled by default on Darwin
AM_COND_IF([HOST_OS_DARWIN],
[QH_VAR_ENSURE([BASH_COMPLETION],
Expand Down Expand Up @@ -334,6 +323,19 @@ AM_COND_IF([HOST_OS_DARWIN],
[/usr/local])
AC_CONFIG_FILES([data/bash/common/homebrew-pathmung])])

## software collections ##

QH_ARG_ENABLE([scl], [no])
AM_CONDITIONAL([ENABLE_SCL], [test "x$enable_scl" = xyes])
AM_COND_IF([ENABLE_SCL],
[QH_REQUIRE_PROG([SCL], [scl], [path to scl])
QH_REQUIRE_PROG([SCL_ENABLED], [scl_enabled], [path to scl_enabled])
QH_REQUIRE_PROG([SCL_SOURCE], [scl_source], [path to scl_source])
QH_VAR_ENSURE([SCL_LIST],
[software collections list],
[`$SCL --list`])
AC_CONFIG_FILES([data/bash/common/profile.d/scl.sh])])

## systemd ##

# check for systemd-path
Expand Down
8 changes: 8 additions & 0 deletions data/bash/common/profile.d/scl.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,13 @@ if echo $- | grep i &> /dev/null; then
if ! @SCL_ENABLED@ $scl; then
source @SCL_SOURCE@ enable $scl
fi
# source the bash-completion for any git software collection
if @GREP@ git <<<$scl &>/dev/null; then
completion=$(find /opt/rh/$scl -path '*/bash-completion/*git' 2>/dev/null)
if [[ -r $completion ]]; then
source $completion
fi
unset completion
fi
done
fi

0 comments on commit 26bf414

Please sign in to comment.