root.rs
24 lines
| 586 B
| application/rls-services+xml
|
RustLexer
Antoine Cezar
|
r45922 | use crate::error::CommandError; | ||
Antoine Cezar
|
r45592 | use crate::ui::Ui; | ||
Simon Sapin
|
r47228 | use clap::ArgMatches; | ||
Raphaël Gomès
|
r46598 | use format_bytes::format_bytes; | ||
Simon Sapin
|
r47213 | use hg::config::Config; | ||
Simon Sapin
|
r46782 | use hg::repo::Repo; | ||
Antoine Cezar
|
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. | ||||
"; | ||||
Simon Sapin
|
r47228 | pub fn run( | ||
ui: &Ui, | ||||
config: &Config, | ||||
_args: &ArgMatches, | ||||
) -> Result<(), CommandError> { | ||||
let repo = Repo::find(config)?; | ||||
let bytes = get_bytes_from_path(repo.working_directory_path()); | ||||
ui.write_stdout(&format_bytes!(b"{}\n", bytes.as_slice()))?; | ||||
Ok(()) | ||||
Antoine Cezar
|
r45592 | } | ||