mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-26 01:57:26 +08:00
Compare commits
4 Commits
a6df94d2c6
...
52f9238b16
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
52f9238b16 | ||
|
|
4fc570b0d4 | ||
|
|
f17e0219fd | ||
|
|
634a50936a |
@ -32,6 +32,8 @@ PORT=3001
|
|||||||
```
|
```
|
||||||
You can even mix both formats, although it's probably a bad idea.
|
You can even mix both formats, although it's probably a bad idea.
|
||||||
|
|
||||||
|
## Plugin options
|
||||||
|
|
||||||
### ZSH_DOTENV_FILE
|
### ZSH_DOTENV_FILE
|
||||||
|
|
||||||
You can also modify the name of the file to be loaded with the variable `ZSH_DOTENV_FILE`.
|
You can also modify the name of the file to be loaded with the variable `ZSH_DOTENV_FILE`.
|
||||||
@ -43,6 +45,10 @@ For example, this will make the plugin look for files named `.dotenv` and load t
|
|||||||
ZSH_DOTENV_FILE=.dotenv
|
ZSH_DOTENV_FILE=.dotenv
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### ZSH_DOTENV_PROMPT
|
||||||
|
|
||||||
|
Set `ZSH_DOTENV_PROMPT=false` in your zshrc file if you don't want the confirmation message.
|
||||||
|
|
||||||
## Version Control
|
## Version Control
|
||||||
|
|
||||||
**It's strongly recommended to add `.env` file to `.gitignore`**, because usually it contains sensitive information such as your credentials, secret keys, passwords etc. You don't want to commit this file, it's supposed to be local only.
|
**It's strongly recommended to add `.env` file to `.gitignore`**, because usually it contains sensitive information such as your credentials, secret keys, passwords etc. You don't want to commit this file, it's supposed to be local only.
|
||||||
|
|||||||
@ -1,10 +1,15 @@
|
|||||||
source_env() {
|
source_env() {
|
||||||
if [[ -f $ZSH_DOTENV_FILE ]]; then
|
if [[ -f $ZSH_DOTENV_FILE ]]; then
|
||||||
# confirm before sourcing .env file
|
if [ "$ZSH_DOTENV_PROMPT" != "false" ]; then
|
||||||
local confirmation
|
# confirm before sourcing file
|
||||||
echo -n "dotenv: source '$ZSH_DOTENV_FILE' file in the directory? (Y/n) "
|
local confirmation
|
||||||
if read -k 1 confirmation && [[ $confirmation = [nN] ]]; then
|
# print same-line prompt and output newline character if necessary
|
||||||
return
|
echo -n "dotenv: source '$ZSH_DOTENV_FILE' file in the directory? (Y/n) "
|
||||||
|
read -k 1 confirmation; [[ "$confirmation" != $'\n' ]] && echo
|
||||||
|
# only bail out if confirmation character is n
|
||||||
|
if [[ "$confirmation" = [nN] ]]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# test .env syntax
|
# test .env syntax
|
||||||
|
|||||||
@ -10,6 +10,7 @@ function setup_using_base_dir() {
|
|||||||
if [[ -z "${fzf_base}" ]]; then
|
if [[ -z "${fzf_base}" ]]; then
|
||||||
fzfdirs=(
|
fzfdirs=(
|
||||||
"${HOME}/.fzf"
|
"${HOME}/.fzf"
|
||||||
|
"${HOME}/.nix-profile/share/fzf"
|
||||||
"/usr/local/opt/fzf"
|
"/usr/local/opt/fzf"
|
||||||
"/usr/share/fzf"
|
"/usr/share/fzf"
|
||||||
"/usr/local/share/examples/fzf"
|
"/usr/local/share/examples/fzf"
|
||||||
@ -31,8 +32,8 @@ function setup_using_base_dir() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -d "${fzf_base}" ]]; then
|
if [[ -d "${fzf_base}" ]]; then
|
||||||
# Fix fzf shell directory for Archlinux package
|
# Fix fzf shell directory for Arch Linux, NixOS or Void Linux packages
|
||||||
if [[ ! -d "${fzf_base}/shell" ]] && [[ -f /etc/arch-release ]]; then
|
if [[ ! -d "${fzf_base}/shell" ]]; then
|
||||||
fzf_shell="${fzf_base}"
|
fzf_shell="${fzf_base}"
|
||||||
else
|
else
|
||||||
fzf_shell="${fzf_base}/shell"
|
fzf_shell="${fzf_base}/shell"
|
||||||
|
|||||||
@ -14,7 +14,7 @@ fi
|
|||||||
alias k=kubectl
|
alias k=kubectl
|
||||||
|
|
||||||
# Execute a kubectl command against all namespaces
|
# Execute a kubectl command against all namespaces
|
||||||
alias kca='f(){ kubectl "$@" --all-namespaces; unset -f f; }; f'
|
alias kca='_kca(){ kubectl "$@" --all-namespaces; unset -f _kca; }; _kca'
|
||||||
|
|
||||||
# Apply a YML file
|
# Apply a YML file
|
||||||
alias kaf='kubectl apply -f'
|
alias kaf='kubectl apply -f'
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user