From 2c7e01cd6221b60cc08d2e5873493c00817ee1b6 Mon Sep 17 00:00:00 2001 From: Barnaby Keene Date: Sun, 20 Oct 2019 09:26:27 +0100 Subject: =?UTF-8?q?refactor:=20improve=20as-a-library=20usage=20by=20remov?= =?UTF-8?q?ing=20ArgMatches=20depe=E2=80=A6=20(#547)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This removes ArgMatches from the Context struct and replaces it with a simple HashMap. This work is towards getting Starship in a better place for use as a library in other shells written in Rust so they don't need to use a command-line interface to invoke and configure things. Contributes to #521 --- src/modules/cmd_duration.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/modules/cmd_duration.rs') diff --git a/src/modules/cmd_duration.rs b/src/modules/cmd_duration.rs index a0340cb0c..7b31c80c3 100644 --- a/src/modules/cmd_duration.rs +++ b/src/modules/cmd_duration.rs @@ -11,10 +11,10 @@ pub fn module<'a>(context: &'a Context) -> Option> { let mut module = context.new_module("cmd_duration"); let config: CmdDurationConfig = CmdDurationConfig::try_load(module.config); - let arguments = &context.arguments; - let elapsed = arguments - .value_of("cmd_duration") - .unwrap_or("invalid_time") + let props = &context.properties; + let elapsed = props + .get("cmd_duration") + .unwrap_or(&"invalid_time".into()) .parse::() .ok()?; -- cgit v1.2.3