Mercurial > public > mercurial-scm > hg-stable
annotate rust/rhg/src/commands.rs @ 45050:513b3ef277a3
rhg: add RootCommand using hg-core FindRoot operation to prepare `hg root`
The println macro is not used to avoid string usage.
Dealing only with bytes allows us to be compatible with any encoding
and not just UTF8.
Later on, format macro will be made to have more readable code.
Differential Revision: https://phab.mercurial-scm.org/D8612
author | Antoine Cezar <antoine.cezar@octobus.net> |
---|---|
date | Fri, 05 Jun 2020 09:01:35 +0200 |
parents | bacf6c7ef01b |
children | 47997afadf08 |
rev | line source |
---|---|
45050
513b3ef277a3
rhg: add RootCommand using hg-core FindRoot operation to prepare `hg root`
Antoine Cezar <antoine.cezar@octobus.net>
parents:
45002
diff
changeset
|
1 pub mod root; |
45002
bacf6c7ef01b
rhg: add Command trait for subcommands implemented by rhg
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff
changeset
|
2 use crate::error::CommandError; |
bacf6c7ef01b
rhg: add Command trait for subcommands implemented by rhg
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff
changeset
|
3 |
bacf6c7ef01b
rhg: add Command trait for subcommands implemented by rhg
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff
changeset
|
4 /// The common trait for rhg commands |
bacf6c7ef01b
rhg: add Command trait for subcommands implemented by rhg
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff
changeset
|
5 /// |
bacf6c7ef01b
rhg: add Command trait for subcommands implemented by rhg
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff
changeset
|
6 /// Normalize the interface of the commands provided by rhg |
bacf6c7ef01b
rhg: add Command trait for subcommands implemented by rhg
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff
changeset
|
7 pub trait Command { |
bacf6c7ef01b
rhg: add Command trait for subcommands implemented by rhg
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff
changeset
|
8 fn run(&self) -> Result<(), CommandError>; |
bacf6c7ef01b
rhg: add Command trait for subcommands implemented by rhg
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff
changeset
|
9 } |