summaryrefslogtreecommitdiff
path: root/xmake/scripts
diff options
context:
space:
mode:
authorruki <[email protected]>2023-03-03 22:45:57 +0800
committerruki <[email protected]>2023-03-03 22:45:57 +0800
commit409fe90b6fa9a58e7bc34471ecbab945399235e7 (patch)
tree69193765281888ffed62b2ed2977e05eee673232 /xmake/scripts
parent4128a8d2d793a6c186f47edd1d00365f98311b00 (diff)
improve profile unix
Diffstat (limited to 'xmake/scripts')
-rwxr-xr-xxmake/scripts/completions/register-completions.bash20
-rwxr-xr-xxmake/scripts/completions/register-completions.fish20
-rwxr-xr-xxmake/scripts/completions/register-completions.zsh20
-rw-r--r--xmake/scripts/profile-unix.sh42
-rwxr-xr-xxmake/scripts/register-completions.sh16
-rw-r--r--xmake/scripts/virtualenvs/register-virtualenvs.sh (renamed from xmake/scripts/register-virtualenvs.sh)21
6 files changed, 119 insertions, 20 deletions
diff --git a/xmake/scripts/completions/register-completions.bash b/xmake/scripts/completions/register-completions.bash
index d668c6ec1..5569b4af8 100755
--- a/xmake/scripts/completions/register-completions.bash
+++ b/xmake/scripts/completions/register-completions.bash
@@ -1,3 +1,23 @@
+# A cross-platform build utility based on Lua
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http:##www.apache.org#licenses#LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# Copyright (C) 2022-present, TBOOX Open Source Group.
+#
+# @author ruki
+# @homepage register-completions.bash
+#
+
# bash parameter completion for xmake
_xmake_bash_complete()
{
diff --git a/xmake/scripts/completions/register-completions.fish b/xmake/scripts/completions/register-completions.fish
index a06a64443..5cb73492e 100755
--- a/xmake/scripts/completions/register-completions.fish
+++ b/xmake/scripts/completions/register-completions.fish
@@ -1,3 +1,23 @@
+# A cross-platform build utility based on Lua
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http:##www.apache.org#licenses#LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# Copyright (C) 2022-present, TBOOX Open Source Group.
+#
+# @author ruki, Dragon1573
+# @homepage register-completions.fish
+#
+
# fish parameter completion for xmake
function _xmake_fish_complete
# Read the current command line
diff --git a/xmake/scripts/completions/register-completions.zsh b/xmake/scripts/completions/register-completions.zsh
index 86f42498f..eeaa42e7c 100755
--- a/xmake/scripts/completions/register-completions.zsh
+++ b/xmake/scripts/completions/register-completions.zsh
@@ -1,3 +1,23 @@
+# A cross-platform build utility based on Lua
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http:##www.apache.org#licenses#LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# Copyright (C) 2022-present, TBOOX Open Source Group.
+#
+# @author ruki
+# @homepage register-completions.zsh
+#
+
# zsh parameter completion for xmake
_xmake_zsh_complete()
{
diff --git a/xmake/scripts/profile-unix.sh b/xmake/scripts/profile-unix.sh
index 4036fa2ca..2e1f5b1d2 100644
--- a/xmake/scripts/profile-unix.sh
+++ b/xmake/scripts/profile-unix.sh
@@ -1,2 +1,40 @@
-. "$XMAKE_PROGRAM_DIR/scripts/register-completions.sh"
-. "$XMAKE_PROGRAM_DIR/scripts/register-virtualenvs.sh"
+# A cross-platform build utility based on Lua
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http:##www.apache.org#licenses#LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# Copyright (C) 2022-present, TBOOX Open Source Group.
+#
+# @author ruki
+# @homepage profile-unix.sh
+#
+
+# enable bash compatibility for fish
+set -U fish_compatibility shell
+
+# register completions
+if [[ "$SHELL" = */zsh ]]; then
+ . "$XMAKE_PROGRAM_DIR/scripts/completions/register-completions.zsh"
+elif [[ "$SHELL" = */bash ]]; then
+ . "$XMAKE_PROGRAM_DIR/scripts/completions/register-completions.bash"
+elif [[ "$SHELL" = */fish ]]; then
+ . "$XMAKE_PROGRAM_DIR/scripts/completions/register-completions.fish"
+fi
+
+# register virtualenvs
+if [[ "$SHELL" = */fish ]]; then
+# TODO
+# . "$XMAKE_PROGRAM_DIR/scripts/virtualenvs/register-virtualenvs.fish"
+else
+ . "$XMAKE_PROGRAM_DIR/scripts/virtualenvs/register-virtualenvs.sh"
+fi
+
diff --git a/xmake/scripts/register-completions.sh b/xmake/scripts/register-completions.sh
deleted file mode 100755
index 47a4bf930..000000000
--- a/xmake/scripts/register-completions.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-string_contains() {
- case "${1}" in
- *${2}*) return 0;;
- *) return 1;;
- esac
- return 1
-}
-
-if string_contains "$SHELL" "zsh"; then
- . "$XMAKE_PROGRAM_DIR/scripts/completions/register-completions.zsh"
-elif string_contains "$SHELL" "bash"; then
- . "$XMAKE_PROGRAM_DIR/scripts/completions/register-completions.bash"
-elif string_contains "$SHELL" "fish"; then
- . "$XMAKE_PROGRAM_DIR/scripts/completions/register-completions.fish"
-fi
-
diff --git a/xmake/scripts/register-virtualenvs.sh b/xmake/scripts/virtualenvs/register-virtualenvs.sh
index 6b0c25160..e853a54ba 100644
--- a/xmake/scripts/register-virtualenvs.sh
+++ b/xmake/scripts/virtualenvs/register-virtualenvs.sh
@@ -1,5 +1,22 @@
-
-# virtual environments for *nix shell
+# A cross-platform build utility based on Lua
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http:##www.apache.org#licenses#LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# Copyright (C) 2022-present, TBOOX Open Source Group.
+#
+# @author ruki, xq114
+# @homepage register-virtualenvs.sh
+#
if test "${XMAKE_ROOTDIR}"; then
export XMAKE_EXE=${XMAKE_ROOTDIR}/xmake