From 4f8a545aac98a5cac6aae49df1a2b9980f9b7f56 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Wed, 30 Dec 2015 02:40:56 +0100 Subject: [PATCH] cli.rs: Add possibility to fetch editor --- etc/cli.yml | 6 ++++++ src/cli.rs | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/etc/cli.yml b/etc/cli.yml index 50ca507c..53f3c9dc 100644 --- a/etc/cli.yml +++ b/etc/cli.yml @@ -22,6 +22,12 @@ args: required: false takes_value: true + - editor: + short: e + long: editor + help: Set editor, if not set $EDITOR of the system will be asked, else vim + required: false + takes_value: true - storename: short: s diff --git a/src/cli.rs b/src/cli.rs index 3b1d8b4b..28e1b153 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -47,6 +47,10 @@ impl<'a> CliConfig<'a> { .and_then(|s| Some(rtp + s)) }) } + + pub fn editor(&self) -> Option { + self.cli_matches.value_of("editor").and_then(|s| Some(String::from(s))) + } } impl<'a> Debug for CliConfig<'a> {