Open patzielinski opened 3 weeks ago
I'd like to work on this : ) One other way crosses my mind to do this is gittuf policy reorder-rule <rule-name> <updated-position>
(assuming no duplicated rule names.) And other rules move accordingly like how insert in ArrayList works
position is hard, though, as it'll be relative to other rule entries. Does --position=3
mean it becomes 3 and pushes the existing rule 3 to 4? What if I say position=10
when there are only 3 rules? Maybe I'm overthinking it, though. I'm definitely also nervous of a full fledged TUI for this, in part because I haven't built one into anything before.
This could also happen in tandem with list-rules
, where list-rules—-interactive
opens an editor, allowing you to move around, add, and remove rules. We could then parse that list-rules file back into the actual policy. Updates to thresholds, additions of keys, or similar changes would be much easier and could be accomplished with a single command.
Maybe the entry method could be all rule names in the desired order they should be in after the command runs? i.e. gittuf policy reorder-rules rulename1 rulename2 etc...
Maybe we can offer two ways to reorder? One is simply command line, either being gittuf policy reorder-rules rulename1 rulename2 etc...
or ArrayList insertion like command with a few edge case checks, and the second way would be interactive TUI as a part of #424. Users can leverage two options depending on the number of rules
Add a description
Currently, gittuf rules cannot be easily reordered without removing them and adding them back in the desired order. As rule order matters in gittuf, adding reordering functionality to make this easier is in order. Maybe something like
gittuf policy reorder-rule <original number> <new number>
, though this needs thought as well.Raised in #424 by @adityasaky.
Relevant log output if the discussion pertains to existing gittuf functionality
No response
Code of Conduct