mirror of
https://github.com/skywind3000/z.lua
synced 2026-03-21 15:19:49 +00:00
update doc
This commit is contained in:
@@ -81,11 +81,11 @@ z -b foo # cd to the parent directory starting with foo
|
||||
|
||||
eval "$(lua /path/to/z.lua --init posix)"
|
||||
|
||||
For very old shells like ksh (Korn Shell), some keywords like `local` and `builtin` are unsupported, you can use:
|
||||
For new posix shells like dash/ash, you can use:
|
||||
|
||||
eval "$(lua /path/to/z.lua --init posix legacy)"
|
||||
eval "$(lua /path/to/z.lua --init posix new)"
|
||||
|
||||
To generate old posix compatible script.
|
||||
To take advantage of keywords `local` and `builtin`.
|
||||
|
||||
- Fish Shell:
|
||||
|
||||
@@ -397,7 +397,7 @@ awk -F '\t' '{print $2 "|" $1 "|" 0}' $FN >> ~/.zlua
|
||||
|
||||
## History
|
||||
|
||||
- 1.4.4 (2019-02-10): supports legacy posix shells like ksh, init with `z.lua --init posix legacy`.
|
||||
- 1.4.4 (2019-02-10): supports legacy posix shells like ksh.
|
||||
- 1.4.3 (2019-02-08): fixed minor issues.
|
||||
- 1.4.2 (2019-02-06): you can disabled path validation by `$_ZL_NO_CHECK`, and use `z --purge` to clear bad paths manually.
|
||||
- 1.4.1 (2019-02-06): fzf tab-completion in bash (@[BarbUk](https://github.com/BarbUk)), fixed hang in fish shell (close [#29](https://github.com/skywind3000/z.lua/issues/29)).
|
||||
|
||||
19
z.lua
19
z.lua
@@ -1790,12 +1790,12 @@ _zlua() {
|
||||
elif [ -n "$arg_mode" ]; then
|
||||
"$ZLUA_LUAEXE" "$ZLUA_SCRIPT" $arg_mode $arg_subdir $arg_type $arg_inter "$@"
|
||||
else
|
||||
local dest=$("$ZLUA_LUAEXE" "$ZLUA_SCRIPT" --cd $arg_type $arg_subdir $arg_inter "$@")
|
||||
if [ -n "$dest" ] && [ -d "$dest" ]; then
|
||||
local zdest=$("$ZLUA_LUAEXE" "$ZLUA_SCRIPT" --cd $arg_type $arg_subdir $arg_inter "$@")
|
||||
if [ -n "$zdest" ] && [ -d "$zdest" ]; then
|
||||
if [ -z "$_ZL_CD" ]; then
|
||||
builtin cd "$dest"
|
||||
builtin cd "$zdest"
|
||||
else
|
||||
$_ZL_CD "$dest"
|
||||
$_ZL_CD "$zdest"
|
||||
fi
|
||||
if [ -n "$_ZL_ECHO" ]; then pwd; fi
|
||||
fi
|
||||
@@ -1916,11 +1916,16 @@ function z_shell_init(opts)
|
||||
print('ZLUA_SCRIPT="' .. os.scriptname() .. '"')
|
||||
print('ZLUA_LUAEXE="' .. os.interpreter() .. '"')
|
||||
print('')
|
||||
if not opts.legacy then
|
||||
if not opts.posix then
|
||||
print(script_zlua)
|
||||
else
|
||||
local script = script_zlua:gsub('local ', ''):gsub('builtin ', '')
|
||||
print(script)
|
||||
if opts.new or opts.modern then
|
||||
print(script_zlua)
|
||||
else
|
||||
local script = script_zlua:gsub('local ', '')
|
||||
script = script:gsub('builtin ', '')
|
||||
print(script)
|
||||
end
|
||||
end
|
||||
|
||||
local prompt_hook = (os.getenv("_ZL_NO_PROMPT_COMMAND") == nil)
|
||||
|
||||
Reference in New Issue
Block a user