Skip to content

Commit

Permalink
Merge pull request #49 from masahide/add-prettier-plugin-sh
Browse files Browse the repository at this point in the history
add prettier-plugin-sh
  • Loading branch information
masahide committed Jan 8, 2024
2 parents 652e801 + 0810495 commit 3f65f5f
Show file tree
Hide file tree
Showing 7 changed files with 108 additions and 14 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ jobs:
run: npm run format
working-directory: ./frontend

- name: Install packages
run: npm ci
working-directory: ./hack
- name: format
run: npm run format
working-directory: ./hack

- name: Install goimports
run: go install golang.org/x/tools/cmd/goimports@latest
- name: Format code
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
build/bin/
wailsjs/
hack/node_modules/
3 changes: 3 additions & 0 deletions hack/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"plugins": ["prettier-plugin-sh"]
}
74 changes: 74 additions & 0 deletions hack/package-lock.json

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

9 changes: 9 additions & 0 deletions hack/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"scripts": {
"format": "prettier --write ."
},
"devDependencies": {
"prettier": "^3.1.1",
"prettier-plugin-sh": "^0.13.1"
}
}
16 changes: 8 additions & 8 deletions hack/rocky.setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,29 @@
OMNISOCATCMD="$HOME/omni-socat/omni-socat.exe"
export SSH_AUTH_SOCK="$HOME/.ssh/agent.sock"

__get_omnisocat () {
__get_omnisocat() {
echo "Downloading omni-socat.exe"
curl https://github.com/masahide/OmniSSHAgent/releases/latest/download/omni-socat.zip \
-sLo omni-socat.zip
-sLo omni-socat.zip
unzip -o omni-socat.zip -d "$(dirname "$OMNISOCATCMD")"
chmod +x "$OMNISOCATCMD"
rm -f omni-socat.zip
}

__get_ss () {
__get_ss() {
echo "Installing ss"
sudo dnf -y install iproute
}

__get_socat () {
__get_socat() {
echo "Installing socat"
sudo dnf -y install socat
}

setup_omnisocat () {
setup_omnisocat() {
[ -f "$OMNISOCATCMD" ] || __get_omnisocat
command -v ss >/dev/null 2>&1 || __get_ss
command -v socat >/dev/null 2>&1 || __get_socat
command -v ss > /dev/null 2>&1 || __get_ss
command -v socat > /dev/null 2>&1 || __get_socat

# Checks wether $SSH_AUTH_SOCK is a socket or not
(ss -a | grep -q "$SSH_AUTH_SOCK") && [ -S "$SSH_AUTH_SOCK" ] && return
Expand All @@ -39,7 +39,7 @@ setup_omnisocat () {
fi

rm -f "$SSH_AUTH_SOCK"
(setsid socat UNIX-LISTEN:"$SSH_AUTH_SOCK",fork EXEC:"$OMNISOCATCMD",nofork &) >/dev/null 2>&1
(setsid socat UNIX-LISTEN:"$SSH_AUTH_SOCK",fork EXEC:"$OMNISOCATCMD",nofork &) > /dev/null 2>&1
}

setup_omnisocat
12 changes: 6 additions & 6 deletions hack/ubuntu.setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,24 @@
OMNISOCATCMD="$HOME/omni-socat/omni-socat.exe"
export SSH_AUTH_SOCK="$HOME/.ssh/agent.sock"

__get_omnisocat () {
__get_omnisocat() {
echo "Downloading omni-socat.exe"
sudo apt -y install unzip
curl https://github.com/masahide/OmniSSHAgent/releases/latest/download/omni-socat.zip \
-sLo omni-socat.zip
-sLo omni-socat.zip
unzip -o omni-socat.zip -d "$(dirname "$OMNISOCATCMD")"
chmod +x "$OMNISOCATCMD"
rm -f omni-socat.zip
}

__get_socat () {
__get_socat() {
echo "Installing socat"
sudo apt -y install socat
}

setup_omnisocat () {
setup_omnisocat() {
[ -f "$OMNISOCATCMD" ] || __get_omnisocat
command -v socat >/dev/null 2>&1 || __get_socat
command -v socat > /dev/null 2>&1 || __get_socat

# Checks wether $SSH_AUTH_SOCK is a socket or not
(ss -a | grep -q "$SSH_AUTH_SOCK") && [ -S "$SSH_AUTH_SOCK" ] && return
Expand All @@ -34,7 +34,7 @@ setup_omnisocat () {
fi

rm -f "$SSH_AUTH_SOCK"
(setsid socat UNIX-LISTEN:"$SSH_AUTH_SOCK",fork EXEC:"$OMNISOCATCMD",nofork &) >/dev/null 2>&1
(setsid socat UNIX-LISTEN:"$SSH_AUTH_SOCK",fork EXEC:"$OMNISOCATCMD",nofork &) > /dev/null 2>&1
}

setup_omnisocat

0 comments on commit 3f65f5f

Please sign in to comment.