printenv2 0.0.2

A printenv rewrite in Rust
printenv2-0.0.2 is not a library.

printenv2

A printenv rewrite in Rust.

Advantages over classic implementations

  • Rich-format output
    • Colored mode
    • Sort mode: output can be sorted by environment variable names
    • Escape mode:
      • Single-line: escape line break characters
      • Unprintable characters
  • Remote mode. See notes
  • Cross-platform

Installation

  • via package managers:
    • Arch Linux: paru -S printenv2
  • via Cargo: Run cargo install printenv2 if you already have Rust development environment setup.

Notes on remote mode

printenv2 comes with the ability to read environment variables of another running process. However, mileage varies depending on the operating system.

The following table shows how each platform is supported.

Platform Environment variables at startup Environment variables in present
Linux printenv2 --by-env-string /proc/<PID>/environ.sudo for processes you don't own. Use at your own risk.A debugger must be used to dump the memory where environment variables are stored. printenv2 remote-env-string-dump generates a shell script for that using gdb.sh <(printenv2 remote-env-string-dump <PID>) | printenv2 --by-env-string -.sudo is likely required.
Windows Unsupported. Use at your own risk.Using undocumented APIs to dump the memory where environment variables are stored.printenv2 remote-env-string-dump <PID> | printenv2 --by-env-string -
Other Unsupported. Unsupported.

TODO

  • Remote mode on more OSes

License

MIT