From 3a30fd8a866fefc6feb7d7c51a6e93809657afa7 Mon Sep 17 00:00:00 2001 From: Glenn Date: Sun, 26 Nov 2023 16:21:47 +0100 Subject: [PATCH] feat: add defaut FZF options when none defined --- src/cli.cr | 1 + src/config.cr | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/src/cli.cr b/src/cli.cr index b15e8be..631d390 100644 --- a/src/cli.cr +++ b/src/cli.cr @@ -96,6 +96,7 @@ module GX when Config::Mode::ShowVersion STDOUT.puts "#{PROGRAM_NAME} #{VERSION}" when Config::Mode::Mount + @config.load_from_env @config.load_from_file filesystem = choose_filesystem raise Models::InvalidFilesystemError.new("Invalid filesystem") if filesystem.nil? diff --git a/src/config.cr b/src/config.cr index 17dbfd2..bb0d0d7 100644 --- a/src/config.cr +++ b/src/config.cr @@ -73,6 +73,13 @@ module GX raise MissingFileError.new("Configuration file not found") end + def load_from_env() + if !ENV["FZF_DEFAULT_OPTS"]? + # force defaults settings if none defined + ENV["FZF_DEFAULT_OPTS"] = "--height 40% --layout=reverse --border" + end + end + def load_from_file config_path = @path if config_path.nil?