Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenBSD pdksh Compatibility #19

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
195 changes: 101 additions & 94 deletions commands/inits/bindata.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion commands/inits/data/git_wrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export SCMPUFF_GIT_CMD="$(\which git)"
# Wrap git with the 'hub' github wrapper, if installed
if type hub > /dev/null 2>&1; then export SCMPUFF_GIT_CMD="hub"; fi

function git() {
git() {
case $1 in
commit|blame|log|rebase|merge)
eval "$(scmpuff expand -- "$SCMPUFF_GIT_CMD" "$@")";;
Expand Down
21 changes: 8 additions & 13 deletions commands/inits/data/status_shortcuts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,16 @@ scmpuff_status() {

# Export numbered env variables for each file
scmpuff_clear_vars
IFS=$'\t'
IFS_CUR=$IFS
# Some shells (pdksh) do not support ANSI C Quoting, i.e. $'\t'
# This temporary IFS is a literal tab character, not a space.
IFS=' '
local e=1
for file in $files; do
export $scmpuff_env_char$e="$file"
let e++
done
IFS=$' \t\n'
IFS=$IFS_CUR

# Print status (from line two onward)
echo "$cmd_output" | tail -n +2
Expand All @@ -36,18 +39,10 @@ scmpuff_status() {
if [ -n "$ZSH_VERSION" ]; then unsetopt shwordsplit; fi;
}


# Clear numbered env variables
scmpuff_clear_vars() {
local scmpuff_env_char="e"
local i

for (( i=1; i<=999; i++ )); do
local env_var_i=${scmpuff_env_char}${i}
if [[ -n ${env_var_i} ]]; then
unset ${env_var_i}
else
break
fi
for v in $(set | sed -n 's_^\(e[1-9][0-9]*\)=.*_\1_p')
do
unset $v
done
}
2 changes: 1 addition & 1 deletion features/command_init.feature
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Feature: init command

Scenario Outline: --wrap controls git cmd wrapping in output (default: yes)
When I successfully run `scmpuff init <flags>`
Then the output <should?> contain "function git()"
Then the output <should?> contain "git()"
Examples:
| flags | should? |
| -s | should |
Expand Down