root.rs
22 lines
| 608 B
| application/rls-services+xml
|
RustLexer
|
r45922 | use crate::error::CommandError; | ||
|
r46598 | use format_bytes::format_bytes; | ||
|
r45592 | use hg::utils::files::get_bytes_from_path; | ||
pub const HELP_TEXT: &str = " | ||||
Print the root directory of the current repository. | ||||
Returns 0 on success. | ||||
"; | ||||
|
r47251 | pub fn args() -> clap::App<'static, 'static> { | ||
clap::SubCommand::with_name("root").about(HELP_TEXT) | ||||
} | ||||
|
r47334 | pub fn run(invocation: &crate::CliInvocation) -> Result<(), CommandError> { | ||
|
r47335 | let repo = invocation.repo?; | ||
|
r47250 | let bytes = get_bytes_from_path(repo.working_directory_path()); | ||
|
r47334 | invocation | ||
.ui | ||||
.write_stdout(&format_bytes!(b"{}\n", bytes.as_slice()))?; | ||||
|
r47250 | Ok(()) | ||
|
r45592 | } | ||