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

Create script to create aliases file #347

Open
wants to merge 2 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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ node_modules/
/tests/playwright/.cache/
/.idea/
.DS_Store
/scripts/aliases

1 change: 1 addition & 0 deletions bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ EOT
fi

./scripts/update-hosts
./scripts/create-aliases

if [[ $(uname -m) == 'arm64' ]]; then
echo "Setting custom containers for arm platform"
Expand Down
42 changes: 42 additions & 0 deletions scripts/create-aliases
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash

localPath="$(realpath "$(dirname "$0" )" )"
basePath="$(dirname "$localPath")"

DCC=
docker-compose version >/dev/null 2>/dev/null && DCC='docker-compose'
docker compose version >/dev/null 2>/dev/null && DCC='docker compose'

if [ -z "$DCC" ]; then
echo "❌ Install docker-compose before running this script"
exit 1
fi

aliasesFile="$localPath/aliases"

cat > "$aliasesFile" <<EOF
nc-dev() {
(cd "$basePath" && $DCC "\$@")
}
occ-dev () {
"$localPath/occ.sh" "\$@"
}
cd-dev () {
if [ \$# -eq 1 ]
then
cd "$basePath/workspace/\$1"
else
cd "$basePath/workspace"
fi
}
EOF

cat <<EOF
The file $aliasesFile has been created.

You can now source this file in your shell:
source "$aliasesFile"
Then, the aliases will be available in your shell.

You can as well put this source command in your .bashrc. That way, the aliases are available in all shells.
EOF
Loading