Skip to main content

reduce

Function reduce 

Source
pub fn reduce(state: CliState, event: CliEvent) -> CliState
Expand description

Pure reducer function for CLI argument processing.

This function takes the current state and an event, returning a new state. It is a pure function with no side effects, making it easy to test.

§Arguments

  • state - The current CLI state
  • event - The event to process

§Returns

A new CLI state with the event applied.

§Event Processing Order

Events are processed in the order they are received. For conflicting options (like multiple presets), the last one wins. This allows users to combine flags where the later flag takes precedence.