rust/rhg/src/commands.rs
author Simon Sapin <simon.sapin@octobus.net>
Thu, 04 Feb 2021 13:17:55 +0100
changeset 46484 a6e4e4650bac
parent 45923 ead435aa5294
child 46500 184e46550dc8
permissions -rw-r--r--
rhg: Parse system and user configuration at program start ? and pass it around up to `Repo::find` Differential Revision: https://phab.mercurial-scm.org/D9962
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
45542
33ded2d3f4fc rhg: add a limited `rhg cat -r` subcommand
Antoine Cezar <antoine.cezar@octobus.net>
parents: 45528
diff changeset
     1
pub mod cat;
45528
66756b34c06e rhg: add a `DebugData` `Command` to prepare the `rhg debugdata` subcommand
Antoine Cezar <antoine.cezar@octobus.net>
parents: 45438
diff changeset
     2
pub mod debugdata;
45923
ead435aa5294 rhg: add a `debugrequirements` subcommand
Simon Sapin <simon-commits@exyr.org>
parents: 45542
diff changeset
     3
pub mod debugrequirements;
45364
5fe25f8ef5d9 rhg: add a `Files` `Command` to prepare the `rhg files` subcommand
Antoine Cezar <antoine.cezar@octobus.net>
parents: 45361
diff changeset
     4
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
     5
pub mod root;
44982
bacf6c7ef01b rhg: add Command trait for subcommands implemented by rhg
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff changeset
     6
use crate::error::CommandError;
45438
ed95ccc94333 rhg: pass `ui` to `Command` `run`
Antoine Cezar <antoine.cezar@octobus.net>
parents: 45364
diff changeset
     7
use crate::ui::Ui;
46484
a6e4e4650bac rhg: Parse system and user configuration at program start
Simon Sapin <simon.sapin@octobus.net>
parents: 45923
diff changeset
     8
use hg::config::Config;
44982
bacf6c7ef01b rhg: add Command trait for subcommands implemented by rhg
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff changeset
     9
bacf6c7ef01b rhg: add Command trait for subcommands implemented by rhg
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff changeset
    10
/// 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
    11
///
bacf6c7ef01b rhg: add Command trait for subcommands implemented by rhg
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff changeset
    12
/// Normalize the interface of the commands provided by rhg
45438
ed95ccc94333 rhg: pass `ui` to `Command` `run`
Antoine Cezar <antoine.cezar@octobus.net>
parents: 45364
diff changeset
    13
pub trait Command {
46484
a6e4e4650bac rhg: Parse system and user configuration at program start
Simon Sapin <simon.sapin@octobus.net>
parents: 45923
diff changeset
    14
    fn run(&self, ui: &Ui, config: &Config) -> Result<(), CommandError>;
44982
bacf6c7ef01b rhg: add Command trait for subcommands implemented by rhg
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff changeset
    15
}