mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-15 16:23:15 +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.
|
||||
|
||||
## Plugin options
|
||||
|
||||
### 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_PROMPT
|
||||
|
||||
Set `ZSH_DOTENV_PROMPT=false` in your zshrc file if you don't want the confirmation message.
|
||||
|
||||
## 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.
|
||||
|
||||
@ -1,10 +1,15 @@
|
||||
source_env() {
|
||||
if [[ -f $ZSH_DOTENV_FILE ]]; then
|
||||
# confirm before sourcing .env file
|
||||
local confirmation
|
||||
echo -n "dotenv: source '$ZSH_DOTENV_FILE' file in the directory? (Y/n) "
|
||||
if read -k 1 confirmation && [[ $confirmation = [nN] ]]; then
|
||||
return
|
||||
if [ "$ZSH_DOTENV_PROMPT" != "false" ]; then
|
||||
# confirm before sourcing file
|
||||
local confirmation
|
||||
# print same-line prompt and output newline character if necessary
|
||||
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
|
||||
|
||||
# test .env syntax
|
||||
|
||||
@ -10,6 +10,7 @@ function setup_using_base_dir() {
|
||||
if [[ -z "${fzf_base}" ]]; then
|
||||
fzfdirs=(
|
||||
"${HOME}/.fzf"
|
||||
"${HOME}/.nix-profile/share/fzf"
|
||||
"/usr/local/opt/fzf"
|
||||
"/usr/share/fzf"
|
||||
"/usr/local/share/examples/fzf"
|
||||
@ -31,8 +32,8 @@ function setup_using_base_dir() {
|
||||
fi
|
||||
|
||||
if [[ -d "${fzf_base}" ]]; then
|
||||
# Fix fzf shell directory for Archlinux package
|
||||
if [[ ! -d "${fzf_base}/shell" ]] && [[ -f /etc/arch-release ]]; then
|
||||
# Fix fzf shell directory for Arch Linux, NixOS or Void Linux packages
|
||||
if [[ ! -d "${fzf_base}/shell" ]]; then
|
||||
fzf_shell="${fzf_base}"
|
||||
else
|
||||
fzf_shell="${fzf_base}/shell"
|
||||
|
||||
@ -14,7 +14,7 @@ fi
|
||||
alias k=kubectl
|
||||
|
||||
# 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
|
||||
alias kaf='kubectl apply -f'
|
||||
|
||||
Loading…
Reference in New Issue
Block a user