Skip to main content

Module shell

Module shell 

Source
Expand description

Shell integration โ€” generates dodot-init.sh.

Unlike the Go implementation which ships a ~400-line shell script that re-discovers the datastore layout at runtime, we generate a flat, declarative script from the actual datastore state. This means:

  • Zero logic duplication between Rust and shell
  • The script is just source and PATH= lines โ€” trivially fast
  • Changes to the datastore layout only need to happen in Rust

The generated script is written to data_dir/shell/dodot-init.sh. Users source it from their shell profile:

[ -f ~/.local/share/dodot/shell/dodot-init.sh ] && . ~/.local/share/dodot/shell/dodot-init.sh

In the future, this can also be exposed as dodot init-sh or a minimal standalone binary for even faster shell startup.

Functionsยง

generate_init_script
Generate the shell init script content from the current datastore state.
write_init_script
Generate and write the init script to data_dir/shell/dodot-init.sh.