feat: add toggle support for sort boolean flags#3777
feat: add toggle support for sort boolean flags#3777alastairsounds wants to merge 1 commit intosxyazi:mainfrom
Conversation
|
Also wondering if I should implement this for the |
yazi-parser/src/mgr/sort.rs
Outdated
| Data::Boolean(true) => Ok(Self::On), | ||
| Data::Boolean(false) => Ok(Self::Off), | ||
| Data::String(s) => s.parse().map_err(Into::into), |
There was a problem hiding this comment.
This treats both boolean and string as SortBoolState, but it isn't clear whether SortBoolState should be serialized as a boolean or a string in Lua, which was in use by https://yazi-rs.github.io/docs/tips#folder-rules
97d744c to
d67dc26
Compare
|
I see what you're saying. I think it should be serialized as a boolean and not handle strings. I don't see a scenario in which a user would need to set With this revision, Lua shouldn't be able to see Toggle being a CLI feature, not Lua, seems like a clean implementation. Or might there be a better route to follow? |
Resolves #3157
Rationale
sort's boolean flags (--reverse,--dir-first,--translit) had no toggle support. This addstoggleas a valid value for each, mirroring the existinghidden togglecommand.Changes
yazi-parser: AddsSortBoolStateenum (none/on/off/toggle), replacingboolfor the three flags. Modelled onHiddenOptState.yazi-actor: Sort actor now calls.bool(old)sononepreserves andtoggleinverts current state.