Skip to content

feat: add zoxide env command - #1287

Open
buiducnhat wants to merge 2 commits into
ajeetdsouza:mainfrom
buiducnhat:feat/env-command
Open

buiducnhat wants to merge 2 commits into
ajeetdsouza:mainfrom
buiducnhat:feat/env-command

Conversation

@buiducnhat

Copy link
Copy Markdown

Summary

Adds a new zoxide env subcommand that prints the resolved values of zoxide's environment variables after defaults have been applied, as proposed in #803.

Since default environment variables vary across platforms and require processing in Rust, this provides a useful angle when debugging configuration issues.

Usage

Print all variables (NAME=VALUE, one per line):

$ zoxide env
_ZO_DATA_DIR=/home/user/.local/share/zoxide
_ZO_ECHO=
_ZO_EXCLUDE_DIRS=/home/user
_ZO_FZF_OPTS=
_ZO_MAXAGE=10000
_ZO_RESOLVE_SYMLINKS=

Print a single variable (raw value, for scripting):

$ zoxide env _ZO_DATA_DIR
/home/user/.local/share/zoxide

Notes

  • Values come directly from the existing functions in config.rs, so the printed output always matches runtime behavior (e.g. _ZO_DATA_DIR falls back to the platform data dir, _ZO_EXCLUDE_DIRS falls back to the home directory glob, _ZO_MAXAGE defaults to 10000).
  • Unset variables with no implicit default (_ZO_ECHO, _ZO_FZF_OPTS, _ZO_RESOLVE_SYMLINKS) are printed with an empty value.
  • Shell completions (all shells) are regenerated via build.rs; a zoxide-env(1) manpage is included and linked from zoxide(1).

Closes #803

Adds a new subcommand to display the resolved values of zoxide's
environment variables after defaults have been applied.

    $ zoxide env
    _ZO_DATA_DIR=/home/user/.local/share/zoxide
    _ZO_ECHO=
    _ZO_EXCLUDE_DIRS=/home/user
    _ZO_FZF_OPTS=
    _ZO_MAXAGE=10000
    _ZO_RESOLVE_SYMLINKS=

    $ zoxide env _ZO_DATA_DIR
    /home/user/.local/share/zoxide

Since defaults vary across platforms and require processing in Rust,
this provides a useful angle when debugging configuration issues.

Closes ajeetdsouza#803
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

New Command Idea: Env

1 participant