debugrequirements.rs
30 lines
| 725 B
| application/rls-services+xml
|
RustLexer
Simon Sapin
|
r46535 | use crate::commands::Command; | ||
Simon Sapin
|
r46536 | use crate::error::CommandError; | ||
Simon Sapin
|
r46535 | use crate::ui::Ui; | ||
use hg::operations::FindRoot; | ||||
Simon Sapin
|
r46536 | use hg::requirements; | ||
Simon Sapin
|
r46535 | |||
pub const HELP_TEXT: &str = " | ||||
Print the current repo requirements. | ||||
"; | ||||
pub struct DebugRequirementsCommand {} | ||||
impl DebugRequirementsCommand { | ||||
pub fn new() -> Self { | ||||
DebugRequirementsCommand {} | ||||
} | ||||
} | ||||
impl Command for DebugRequirementsCommand { | ||||
fn run(&self, ui: &Ui) -> Result<(), CommandError> { | ||||
let root = FindRoot::new().run()?; | ||||
Simon Sapin
|
r46536 | let mut output = String::new(); | ||
for req in requirements::load(&root)? { | ||||
output.push_str(&req); | ||||
output.push('\n'); | ||||
} | ||||
ui.write_stdout(output.as_bytes())?; | ||||
Simon Sapin
|
r46535 | Ok(()) | ||
} | ||||
} | ||||