Feature Request: STOP_ON_ENDSTOP possible with individual endstop pin, or SET_ENDSTOP for a stepper

Dear Klipper Community,

Afaik it is not possible to move any axis until a endstop pin provided at runtime - only to the endstops predefined in the config. To make the MMU2S unit operate smoothly and fast it would be very nice to change the endstops for a stepper with something like SET_ENDSTOP <stepper_name> or similar.

The MMU2S has an extruder gear feeding filament into a direct drive extruder. The MMU2S has a filament sensor controlling the proper loading of the filaments. The extruder has a filament sensor controlling the proper loading of the filament into the extruder.

Now there are multiple approaches to make this work already but to have it run as smooth and fast as possible it would be very cool to do this:
Drive MMU2S gear until the filament sensor at the MMU is triggered. Then drive MMU2S and the extruder gears simultaneously until the filament sensor at the extruder is triggered.

4 Options:
Python is not new to me and I am willing to dive into it - a little help where to start would be gladly appreciated though.

  1. I guess the simplest solution would be to implement a SET_ENDSTOP command
  2. Alternatively alter the MANUAL_STEPPER command with a new parameter for a specific endstop pin or alter the STOP_ON_ENDSTOP parameter
  3. Make stepper aliases (or aliases in general) possible: E.g.:
[manual_stepper lock_stepper]
step_pin: xy:PB10
dir_pin: xy:PB11
enable_pin: !xy:PB2
rotation_distance: 2
endstop_pin: !xy:PA2

[manual_stepper lock_stepper_2]
derived_from: lock_stepper
endstop_pin: xy:PA1
  1. Multiple endstops for a stepper in a config

I guess 1 would be the easiest and 2 would probably be the more generic and still not that difficult to implement feature - what do you think?

Best regards,