Wrap nushell integration script in a module

This prevents the completion command "nu-complete __zoxide_z" from
polluting the command namespace.
This commit is contained in:
Juhan280 2026-02-12 17:08:30 +06:00
parent 32ed3ec28a
commit bdedc2a813
1 changed files with 121 additions and 112 deletions

View File

@ -1,11 +1,13 @@
{%- let section = "# =============================================================================\n#" -%} {%- let section = "# =============================================================================" -%}
{%- let not_configured = "# -- not configured --" -%} {%- let not_configured = "# -- not configured --" -%}
# Code generated by zoxide. DO NOT EDIT. # Code generated by zoxide. DO NOT EDIT.
module zoxide_integration {
const homedir = if $nu.home-dir? != null { $nu.home-dir } else { $nu.home-path } const homedir = if $nu.home-dir? != null { $nu.home-dir } else { $nu.home-path }
{{ section }} {{ section }}
#
# Hook configuration for zoxide. # Hook configuration for zoxide.
# #
@ -54,6 +56,7 @@ export-env {
{%- endif %} {%- endif %}
{{ section }} {{ section }}
#
# Completion for __zoxide_z # Completion for __zoxide_z
# #
@ -84,6 +87,7 @@ def "nu-complete __zoxide_z" [context: string] {
} }
{{ section }} {{ section }}
#
# When using zoxide with --no-cmd, alias these internal functions as desired. # When using zoxide with --no-cmd, alias these internal functions as desired.
# #
@ -112,6 +116,7 @@ export def --env --wrapped __zoxide_zi [...rest: string] {
} }
{{ section }} {{ section }}
#
# Commands for zoxide. Disable these using --no-cmd. # Commands for zoxide. Disable these using --no-cmd.
# #
@ -126,8 +131,12 @@ export alias {{cmd}}i = __zoxide_zi
{{ not_configured }} {{ not_configured }}
{%- endmatch %} {%- endmatch %}
}
export use zoxide_integration *
{{ section }} {{ section }}
#
# Add this to your env file (find it by running `$nu.env-path` in Nushell): # Add this to your env file (find it by running `$nu.env-path` in Nushell):
# #
# zoxide init nushell | save -f ~/.zoxide.nu # zoxide init nushell | save -f ~/.zoxide.nu