From ccd704bca0a55a87bf6eb0c0da20cc909e6366bc Mon Sep 17 00:00:00 2001 From: Derek Stavis Date: Wed, 14 Oct 2015 00:31:52 -0300 Subject: [PATCH] omf.theme: Validate if theme is installed --- pkg/omf/cli/omf.theme.fish | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/omf/cli/omf.theme.fish b/pkg/omf/cli/omf.theme.fish index 4de52e0..4af3a4a 100644 --- a/pkg/omf/cli/omf.theme.fish +++ b/pkg/omf/cli/omf.theme.fish @@ -1,4 +1,10 @@ function omf.theme -a target_theme + if not contains "$target_theme" (omf.packages.list --installed --theme) + echo (omf::err)"Theme not installed!"(omf::off) + echo Install it using (omf::em)omf install $target_theme(omf::off) + return $OMF_INVALID_ARG + end + set -l current_theme (cat $OMF_CONFIG/theme) test "$target_theme" = "$current_theme"; and return 0 @@ -10,7 +16,7 @@ function omf.theme -a target_theme if not omf.check.fish_prompt echo (omf::err)"Conflicting prompt setting."(omf::off) echo "Run "(omf::em)"omf doctor"(omf::off)" and fix issues before continuing." - return 1 + return $OMF_INVALID_ARG end # Replace autoload paths of current theme with the target one