rust/rhg/src/commands.rs
author Antoine Cezar <antoine.cezar@octobus.net>
Wed, 29 Jul 2020 10:21:17 +0200
changeset 45364 5fe25f8ef5d9
parent 45361 47997afadf08
child 45438 ed95ccc94333
permissions -rw-r--r--
rhg: add a `Files` `Command` to prepare the `rhg files` subcommand Differential Revision: https://phab.mercurial-scm.org/D8868
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
45364
5fe25f8ef5d9 rhg: add a `Files` `Command` to prepare the `rhg files` subcommand
Antoine Cezar <antoine.cezar@octobus.net>
parents: 45361
diff changeset
     1
pub mod files;
45049
513b3ef277a3 rhg: add RootCommand using hg-core FindRoot operation to prepare `hg root`
Antoine Cezar <antoine.cezar@octobus.net>
parents: 44982
diff changeset
     2
pub mod root;
44982
bacf6c7ef01b rhg: add Command trait for subcommands implemented by rhg
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff changeset
     3
use crate::error::CommandError;
bacf6c7ef01b rhg: add Command trait for subcommands implemented by rhg
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff changeset
     4
bacf6c7ef01b rhg: add Command trait for subcommands implemented by rhg
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff changeset
     5
/// 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
     6
///
bacf6c7ef01b rhg: add Command trait for subcommands implemented by rhg
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff changeset
     7
/// Normalize the interface of the commands provided by rhg
45361
47997afadf08 rhg: ask the error message from `CommandError`
Antoine Cezar <antoine.cezar@octobus.net>
parents: 45049
diff changeset
     8
pub trait Command<'a> {
44982
bacf6c7ef01b rhg: add Command trait for subcommands implemented by rhg
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff changeset
     9
    fn run(&self) -> Result<(), CommandError>;
bacf6c7ef01b rhg: add Command trait for subcommands implemented by rhg
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff changeset
    10
}