aKode fase 5: rinomina interna (crate akode-*, akode-rs/, akode-cli/, binario akode, AKODE_*, ~/.akode, snapshot)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
40
akode-rs/tools/src/tool_config.rs
Normal file
40
akode-rs/tools/src/tool_config.rs
Normal file
@@ -0,0 +1,40 @@
|
||||
use akode_features::Feature;
|
||||
use akode_features::Features;
|
||||
use akode_protocol::config_types::ModeKind;
|
||||
use akode_protocol::config_types::TUI_VISIBLE_COLLABORATION_MODES;
|
||||
|
||||
pub fn request_user_input_available_modes(features: &Features) -> Vec<ModeKind> {
|
||||
TUI_VISIBLE_COLLABORATION_MODES
|
||||
.into_iter()
|
||||
.filter(|mode| {
|
||||
mode.allows_request_user_input()
|
||||
|| (features.enabled(Feature::DefaultModeRequestUserInput)
|
||||
&& *mode == ModeKind::Default)
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum ToolEnvironmentMode {
|
||||
None,
|
||||
Single,
|
||||
Multiple,
|
||||
}
|
||||
|
||||
impl ToolEnvironmentMode {
|
||||
pub fn from_count(count: usize) -> Self {
|
||||
match count {
|
||||
0 => Self::None,
|
||||
1 => Self::Single,
|
||||
_ => Self::Multiple,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn has_environment(self) -> bool {
|
||||
!matches!(self, Self::None)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[path = "tool_config_tests.rs"]
|
||||
mod tests;
|
||||
Reference in New Issue
Block a user