debugrequirements.rs
30 lines
| 716 B
| application/rls-services+xml
|
RustLexer
|
r46535 | use crate::commands::Command; | ||
|
r46536 | use crate::error::CommandError; | ||
|
r46535 | use crate::ui::Ui; | ||
|
r46751 | use hg::operations::find_root; | ||
|
r46536 | use hg::requirements; | ||
|
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> { | ||||
|
r46751 | let root = find_root()?; | ||
|
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())?; | ||||
|
r46535 | Ok(()) | ||
} | ||||
} | ||||