Skip to main content

diff_sessions

Function diff_sessions 

Source
pub fn diff_sessions(
    session1: &Session,
    session2: &Session,
    json: bool,
    output: &Output,
) -> Result<()>
Expand description

Produce a unified diff of commands between two sessions.

Compares the command text from session1 and session2 using line-based diff via the similar crate.

§Output modes

  • Human: unified diff with optional color (red for deletions, green for insertions, cyan for hunk headers)
  • JSON: structured change list with summary

§Edge cases

  • Both sessions empty: prints “Both sessions have no commands”
  • Identical sessions: prints “Sessions are identical”

§Errors

Returns an error only on I/O failures (unlikely for stdout).