Skip to content

Commit

Permalink
allow bypassing the executable bit on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Mythra committed Mar 9, 2020
1 parent e04fe07 commit 8dca2a0
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
* Introduce "wrap" functions for sash commands so they don't just
cause your shell to randomly exit, leaving you in an undiagnosed
state.
* Allow sash to work on windows by adding an option to not check the executable
bit.

## 1.3.0 (October 14th, 2019)

Expand Down Expand Up @@ -54,4 +56,3 @@
## 1.0.0 (Feburary 28th, 2018)

* Initial Release of SASH.

16 changes: 14 additions & 2 deletions sash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@ source "$SASH_DIR/sash-libs/sash-trap/sash-trap.sh"
source "$SASH_DIR/sash-libs/sash-err-stack/sash-err-stack.sh"
source "$SASH_DIR/sash-utils/sash-utils.sh"

export SASH_IS_WINDOWS=0
case "$(uname -s)" in
CYGWIN*)
SASH_IS_WINDOWS=1
;;
MINGW*)
SASH_IS_WINDOWS=1
;;
*)
;;
esac

# _sash_init_categories() -> None
#
# Modifies Variables:
Expand Down Expand Up @@ -81,7 +93,7 @@ for __sash_loop_dir in "${_sash_category_dirs[@]}"; do
_sash_subcategory_dirs=( $(find "$HOME/.bash/plugins/$__sash_loop_dir" -maxdepth 1 -type d -printf '%P\n' | grep -v "^\.$" | grep -v "^\.\.$" | grep -v "^$") )
for __sash_loop_sub_dir in "${_sash_subcategory_dirs[@]}"; do
for __sash_filename in $HOME/.bash/plugins/$__sash_loop_dir/$__sash_loop_sub_dir/*.sh; do
[[ -x $__sash_filename ]] || continue
[[ -x $__sash_filename ]] || [ "$SASH_IS_WINDOWS" -eq 1 ] || continue
[[ -n $SASH_TRACE ]] && echo "\n\nSourcing File: $__sash_filename\n\n"
[[ -n $SASH_TRACE ]] && set -x
start_time="$SECONDS"
Expand All @@ -99,7 +111,7 @@ export SASH_LOADED=1

if [[ -d "$HOME/.bash/plugins/post" ]]; then
for __sash_filename in $HOME/.bash/plugins/post/*.sh; do
[[ -x "$__sash_filename" ]] || continue
[[ -x "$__sash_filename" ]] || [ "$SASH_IS_WINDOWS" -eq 1 ] || continue
[[ -n $SASH_TRACE ]] && echo "\n\nSourcing File: $__sash_filename\n\n"
[[ -n $SASH_TRACE ]] && set -x
start_time="$SECONDS"
Expand Down
4 changes: 2 additions & 2 deletions subcommands/sash-package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ _sash_package_subcategory() {

local filename=""
for filename in $full_category_path/*.sh; do
[[ -x $filename ]] || continue
[[ -x $filename ]] || [ "$SASH_IS_WINDOWS" -eq 1 ] || continue

if [[ "$run_checks" == "1" ]]; then
local options=("YES" "NO")
Expand Down Expand Up @@ -85,7 +85,7 @@ _sash_package_category() {
for subcategory in "${subcategories[@]}"; do
mkdir -p "$temp_dir/$subcategory"
for filename in $full_category_path/$subcategory/*.sh; do
[[ -x $filename ]] || continue
[[ -x $filename ]] || [ "$SASH_IS_WINDOWS" -eq 1 ] || continue

if [[ "$run_checks" == "1" ]]; then
local options=("YES" "NO")
Expand Down
2 changes: 1 addition & 1 deletion subcommands/sash-show.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ _sash_materialize_view() {
fi

for filename in $dir/*.sh; do
[[ -x $filename ]] || continue
[[ -x $filename ]] || [ "$SASH_IS_WINDOWS" -eq 1 ] || continue
echo ""
echo "###############################################################"
echo "# Content from: $filename"
Expand Down

0 comments on commit 8dca2a0

Please sign in to comment.