diff options
author | NeonXP <i@neonxp.ru> | 2024-01-28 20:43:11 +0300 |
---|---|---|
committer | NeonXP <i@neonxp.ru> | 2024-01-28 22:07:35 +0300 |
commit | 11412b2e720f754900b39d195f33af39ed11d085 (patch) | |
tree | 96d7e561f21809aead3c0f25034f083f46ef064c /features/src/common-utils/bin/code | |
parent | 6c00916212073678bbeb3bdde3f121c4efad707a (diff) |
Diffstat (limited to 'features/src/common-utils/bin/code')
-rwxr-xr-x | features/src/common-utils/bin/code | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/features/src/common-utils/bin/code b/features/src/common-utils/bin/code new file mode 100755 index 0000000..b0d517f --- /dev/null +++ b/features/src/common-utils/bin/code @@ -0,0 +1,16 @@ +#!/bin/sh + +get_in_path_except_current() { + which -a "$1" | grep -A1 "$0" | grep -v "$0" +} + +code="$(get_in_path_except_current code)" + +if [ -n "$code" ]; then + exec "$code" "$@" +elif [ "$(command -v code-insiders)" ]; then + exec code-insiders "$@" +else + echo "code or code-insiders is not installed" >&2 + exit 127 +fi |