mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-12 15:34:50 +08:00
Compare commits
8 Commits
666f4fa1a1
...
7c9286a7ee
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7c9286a7ee | ||
|
|
ddec79ad43 | ||
|
|
0ebeae78d0 | ||
|
|
3b66f643e4 | ||
|
|
953f526dea | ||
|
|
1b4497fc8f | ||
|
|
43079320a2 | ||
|
|
ee19e2b847 |
6
.github/workflows/dependencies.yml
vendored
6
.github/workflows/dependencies.yml
vendored
@ -13,17 +13,17 @@ jobs:
|
||||
contents: write # this is needed to push commits and branches
|
||||
steps:
|
||||
- name: Harden the runner (Audit all outbound calls)
|
||||
uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
|
||||
uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Authenticate as @ohmyzsh
|
||||
id: generate-token
|
||||
uses: actions/create-github-app-token@7e473efe3cb98aa54f8d4bac15400b15fad77d94 # v2.2.0
|
||||
uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1
|
||||
with:
|
||||
app-id: ${{ secrets.OHMYZSH_APP_ID }}
|
||||
private-key: ${{ secrets.OHMYZSH_APP_PRIVATE_KEY }}
|
||||
|
||||
@ -4,4 +4,4 @@ idna==3.11
|
||||
PyYAML==6.0.3
|
||||
requests==2.32.5
|
||||
semver==3.0.4
|
||||
urllib3==2.5.0
|
||||
urllib3==2.6.0
|
||||
|
||||
8
.github/workflows/installer.yml
vendored
8
.github/workflows/installer.yml
vendored
@ -26,12 +26,12 @@ jobs:
|
||||
- macos-latest
|
||||
steps:
|
||||
- name: Harden the runner (Audit all outbound calls)
|
||||
uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
|
||||
uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
- name: Set up git repository
|
||||
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
- name: Install zsh
|
||||
if: runner.os == 'Linux'
|
||||
run: sudo apt-get update; sudo apt-get install zsh
|
||||
@ -47,12 +47,12 @@ jobs:
|
||||
- test
|
||||
steps:
|
||||
- name: Harden the runner (Audit all outbound calls)
|
||||
uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
|
||||
uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
- name: Install Vercel CLI
|
||||
run: npm install -g vercel
|
||||
- name: Setup project and deploy
|
||||
|
||||
4
.github/workflows/main.yml
vendored
4
.github/workflows/main.yml
vendored
@ -24,12 +24,12 @@ jobs:
|
||||
if: github.repository == 'ohmyzsh/ohmyzsh'
|
||||
steps:
|
||||
- name: Harden the runner (Audit all outbound calls)
|
||||
uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
|
||||
uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
- name: Set up git repository
|
||||
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
- name: Install zsh
|
||||
run: sudo apt-get update; sudo apt-get install zsh
|
||||
- name: Check syntax
|
||||
|
||||
4
.github/workflows/project.yml
vendored
4
.github/workflows/project.yml
vendored
@ -17,12 +17,12 @@ jobs:
|
||||
if: github.repository == 'ohmyzsh/ohmyzsh'
|
||||
steps:
|
||||
- name: Harden the runner (Audit all outbound calls)
|
||||
uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
|
||||
uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
|
||||
with:
|
||||
egress-policy: audit
|
||||
- name: Authenticate as @ohmyzsh
|
||||
id: generate-token
|
||||
uses: actions/create-github-app-token@7e473efe3cb98aa54f8d4bac15400b15fad77d94 # v2.2.0
|
||||
uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1
|
||||
with:
|
||||
app-id: ${{ secrets.OHMYZSH_APP_ID }}
|
||||
private-key: ${{ secrets.OHMYZSH_APP_PRIVATE_KEY }}
|
||||
|
||||
6
.github/workflows/scorecard.yml
vendored
6
.github/workflows/scorecard.yml
vendored
@ -36,12 +36,12 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Harden the runner (Audit all outbound calls)
|
||||
uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
|
||||
uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
- name: "Checkout code"
|
||||
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
@ -60,6 +60,6 @@ jobs:
|
||||
retention-days: 5
|
||||
|
||||
- name: "Upload to code-scanning"
|
||||
uses: github/codeql-action/upload-sarif@fdbfb4d2750291e159f0156def62b853c2798ca2 # v4.31.5
|
||||
uses: github/codeql-action/upload-sarif@cf1bb45a277cb3c205638b2cd5c984db1c46a412 # v4.31.7
|
||||
with:
|
||||
sarif_file: results.sarif
|
||||
|
||||
29
plugins/vault-switch/README.md
Normal file
29
plugins/vault-switch/README.md
Normal file
@ -0,0 +1,29 @@
|
||||
# Vault-switch plugin
|
||||
|
||||
## Description
|
||||
|
||||
This plugin can switch among nodes of Vault - HashiCorp
|
||||
|
||||
## Configuration
|
||||
|
||||
For using a plugin you should add VAULT_NODES to **~/.zshrc**
|
||||
Variable **VAULT_NODES** must look as
|
||||
|
||||
```bash
|
||||
VAULT_NODES="node1,https://vault1.example.com,secret_token1;node2,https://vault2.example.com,secret_token2"
|
||||
```
|
||||
|
||||
If you want to skip verify checking of ssl then add true to end of the string.
|
||||
|
||||
```bash
|
||||
VAULT_NODES="node1,https://vault1.example.com,secret_token1,true;node2,https://vault2.example.com,secret_token2"
|
||||
```
|
||||
|
||||
Name of a node, address, token are separating comma. Other nodes separate semicolon.
|
||||
After need to add the name of the plugin to **~/.zshrc** to variable **plugins=(vault-switch)**
|
||||
|
||||
**Example usage:**
|
||||
|
||||

|
||||
|
||||
State of restoring stored in **~/.vault-switch/credentials**
|
||||
BIN
plugins/vault-switch/example.png
Normal file
BIN
plugins/vault-switch/example.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.1 KiB |
57
plugins/vault-switch/vault-switch.plugin.zsh
Normal file
57
plugins/vault-switch/vault-switch.plugin.zsh
Normal file
@ -0,0 +1,57 @@
|
||||
autoload -U add-zsh-hook
|
||||
add-zsh-hook precmd _restore_cache
|
||||
|
||||
FILE_CREDENTIALS="${HOME}/.vault-switch/credentials"
|
||||
|
||||
_restore_cache(){
|
||||
[ ! -d ${HOME}/.vault-switch ] && mkdir -p ${HOME}/.vault-switch
|
||||
[ ! -f $FILE_CREDENTIALS ] && touch ${FILE_CREDENTIALS}
|
||||
source ${FILE_CREDENTIALS}
|
||||
}
|
||||
|
||||
_get-nodes(){
|
||||
IFS=";" read -A NODES <<< ${VAULT_NODES}
|
||||
}
|
||||
|
||||
_set-color(){
|
||||
echo "\e[1;32m$1\e[0m"
|
||||
}
|
||||
|
||||
_list-nodes(){
|
||||
INDEX=1
|
||||
for i in ${NODES[@]}
|
||||
do
|
||||
NODE=$(echo $i | cut -d "," -f 1)
|
||||
[[ "${NODE}" == "${VAULT_SELECT_NODE}" ]] && ASTERISK="*"
|
||||
echo "${INDEX}) ${NODE} $(_set-color ${ASTERISK})"
|
||||
INDEX=$[$INDEX+1]
|
||||
unset ASTERISK
|
||||
done
|
||||
}
|
||||
|
||||
_set-work-node(){
|
||||
if [ $1 -gt ${#NODES[@]} ]
|
||||
then
|
||||
echo "Number of node not found"
|
||||
else
|
||||
VAULT_SELECT_NODE=$(echo ${NODES[$1]} | cut -d "," -f 1)
|
||||
VAULT_ADDR=$(echo ${NODES[$1]} | cut -d "," -f 2)
|
||||
VAULT_TOKEN=$(echo ${NODES[$1]} | cut -d "," -f 3)
|
||||
VAULT_SKIP_VERIFY=$(echo ${NODES[$1]} | cut -d "," -f 4)
|
||||
|
||||
echo > ${FILE_CREDENTIALS}
|
||||
echo "export VAULT_SELECT_NODE=${VAULT_SELECT_NODE}" >> ${FILE_CREDENTIALS}
|
||||
echo "export VAULT_ADDR=${VAULT_ADDR}" >> ${FILE_CREDENTIALS}
|
||||
echo "export VAULT_TOKEN=${VAULT_TOKEN}" >> ${FILE_CREDENTIALS}
|
||||
[[ $VAULT_SKIP_VERIFY ]] && echo "export VAULT_SKIP_VERIFY=true" >> ${FILE_CREDENTIALS}
|
||||
|
||||
_list-nodes
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
vault-switch() {
|
||||
_get-nodes
|
||||
[ ! $1 ] && _list-nodes
|
||||
[ $1 ] && _set-work-node $1
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user