1
0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2026-04-10 16:32:00 +00:00

Compare commits

...

8 Commits

Author SHA1 Message Date
curry798
b79322aa6f Merge ff2e2187e1 into 7c10d9839f 2026-04-08 13:12:48 +00:00
Chris Schindlbeck
7c10d9839f feat(terraform): add aliases for terraform: tfapp, tfpo 2026-04-07 12:25:32 +02:00
Chris Schindlbeck
103246c198 feat(opentofu): add aliases for opentofu: ttap, ttapp, ttir, ttiu, ttiur, ttpo 2026-04-07 12:25:32 +02:00
curry798
ff2e2187e1 Merge pull request #1 from x-cmd-sourcecode/fea-250109-x-cmd
add x-cmd plugin
2026-01-19 16:24:50 +08:00
curry798
de26c8cd22 feat(x-cmd): Improve silent execution and simplify setup prompt 2026-01-19 16:20:24 +08:00
curry798
697b9a9930 Fix: x-cmd unavailable/Resolve x-cmd failure 2026-01-19 15:38:29 +08:00
Li Junhao
1c2479a563 Update proxy example 2026-01-10 03:32:53 +08:00
Li Junhao
6563ae107e Introducing x-cmd plugin for ohmyzsh 2026-01-10 03:28:19 +08:00
4 changed files with 81 additions and 5 deletions

View File

@@ -30,14 +30,20 @@ function tofu_version_prompt_info() {
alias tt='tofu'
alias tta='tofu apply'
alias tta!='tofu apply -auto-approve'
alias ttap='tofu apply -parallelism=1'
alias ttapp='tofu apply tfplan'
alias ttc='tofu console'
alias ttd='tofu destroy'
alias ttd!='tofu destroy -auto-approve'
alias ttf='tofu fmt'
alias ttfr='tofu fmt -recursive'
alias tti='tofu init'
alias ttir='tofu init -reconfigure'
alias ttiu='tofu init -upgrade'
alias ttiur='tofu init -upgrade -reconfigure'
alias tto='tofu output'
alias ttp='tofu plan'
alias ttpo='tofu plan -out tfplan'
alias ttv='tofu validate'
alias tts='tofu state'
alias ttsh='tofu show'

View File

@@ -4,21 +4,21 @@ function tf_prompt_info() {
# check if in terraform dir and file exists
[[ -d "${TF_DATA_DIR:-.terraform}" && -r "${TF_DATA_DIR:-.terraform}/environment" ]] || return
local workspace="$(< "${TF_DATA_DIR:-.terraform}/environment")"
local workspace="$(<"${TF_DATA_DIR:-.terraform}/environment")"
echo "${ZSH_THEME_TF_PROMPT_PREFIX-[}${workspace:gs/%/%%}${ZSH_THEME_TF_PROMPT_SUFFIX-]}"
}
function tf_version_prompt_info() {
local terraform_version
terraform_version=$(terraform --version | head -n 1 | cut -d ' ' -f 2)
echo "${ZSH_THEME_TF_VERSION_PROMPT_PREFIX-[}${terraform_version:gs/%/%%}${ZSH_THEME_TF_VERSION_PROMPT_SUFFIX-]}"
local terraform_version
terraform_version=$(terraform --version | head -n 1 | cut -d ' ' -f 2)
echo "${ZSH_THEME_TF_VERSION_PROMPT_PREFIX-[}${terraform_version:gs/%/%%}${ZSH_THEME_TF_VERSION_PROMPT_SUFFIX-]}"
}
alias tf='terraform'
alias tfa='terraform apply'
alias tfa!='terraform apply -auto-approve'
alias tfap='terraform apply -parallelism=1'
alias tfapp='terraform apply tfplan'
alias tfc='terraform console'
alias tfd='terraform destroy'
alias tfd!='terraform destroy -auto-approve'
@@ -31,6 +31,7 @@ alias tfiu='terraform init -upgrade'
alias tfiur='terraform init -upgrade -reconfigure'
alias tfo='terraform output'
alias tfp='terraform plan'
alias tfpo='terraform plan -out tfplan'
alias tfv='terraform validate'
alias tfs='terraform state'
alias tft='terraform test'

33
plugins/x-cmd/README.md Normal file
View File

@@ -0,0 +1,33 @@
# X-CMD
To start using it, add the `x-cmd` plugin to your `plugins` array in `~/.zshrc`:
```zsh
plugins=(... x-cmd)
```
## Functions
### `x`
```zsh
x yq # Using yq command to interract with YML. If yq is not avaiable in the machine. X-CMD will download and directly execute the binary on demand without installation. X-CMD try to avoid influence the environment and folder and always find the solution with least impact.
x fjo # Posix shell CLI to interactve with forgejo.
x cb # Posix shell CLI to interactve with codeberg.
x nihao # For more information about using gpt, gemini, etc in terminal.
```
### `m`
m for `machine`.
In mac, it is [`x mac`](https://x-cmd.com/mod/mac).
In termux, it is [`x termux`](https://x-cmd.com/mod/termux).
```bash
m ss # Info about systemsetup
m app # List application status
m proxy enable 8090 # Set
```

View File

@@ -0,0 +1,36 @@
x(){(
@info(){
printf "%s\n" "$@"
}
if [ -e "$HOME/.x-cmd.root/X" ]; then
. "$HOME/.x-cmd.root/X"
___x_cmd "$@"
return $?
fi
local cmdstr=""
if command -v curl >/dev/null 2>&1; then
cmdstr='eval "$(curl -s https://get.x-cmd.com)"'
elif command -v wget >/dev/null 2>&1; then
cmdstr='eval "$(wget -O- https://get.x-cmd.com)"'
fi
@info "X-CMD is not installed. Do you want to install x-cmd ?"
@info "Command using is -> $cmdstr"
local answer=""
read -q "answer?Please press y for yes. Ctrl-C will also abort the setup. "
case "$answer" in
y|Y|yes)
echo "Setup is going now."
eval "$cmdstr"
return 0
;;
*)
echo ""
;;
esac
)}