Export configuration after tide configure
FelipeEmos opened this issue · 4 comments
Is your feature request related to a problem? Please describe
I want to automate my tide configure process by being able to save my configuration.
I came across this because it was somewhat hard to manage my dotfiles with tide and the barrier of understanding all the docs
about the various ways to configure it is not something I want to do right now, I'd much rather stick with my initial configuration after running tide configure
and just incrementally change what I want.
Describe the solution you'd like
I already implemented what I want. At the final step of tide configure
it looks something like this:
I'd like your opinion on this feature and on how I achieved it.
If you also find value in this feature please mark this Issue with an emoji or something nice I guess?
I'll happily open a PR if the community finds this valueable!
My Solution
I changed the finish.fish
file to have an additional option
# FIXME: Is this path a good path for non UNIX users?
set -g tide_config_export_location /tmp/last-tide-config.fish
function finish:
set_color red
_tide_title 'Overwrite tide config?'
set_color normal
_tide_option y Yes
echo
# This is NEW
_tide_option e "Export this configuration to '$tide_config_export_location'"
echo
_tide_menu
switch $_tide_selected_option
case y
_tide_finish
command -q clear && clear
# This is NEW
case e
_tide_export_config
command -q clear && clear
echo "Configuration exported to '$tide_config_export_location'"
end
end
Then I created this _tide_export_config
function that exports exactly the content of _tide_finish
into this file at $tide_config_export_location
function _tide_export_config
set -e _tide_selected_option # Skip through all the _next_choices
# Deal with prompt char/vi mode
contains character $fake_tide_left_prompt_items || set -p fake_tide_left_prompt_items vi_mode
for fakeVar in (set --names | string match -r "^fake_tide.*")
set finalVarName (string replace 'fake_' '' $fakeVar)
set finalVarValue (eval echo \$$fakeVar)
if test "$finalVarValue" = " "
echo "set -U $finalVarName ' '" >> $tide_config_export_location
else if test -z "$finalVarValue"
echo "set -U $finalVarName ''" >> $tide_config_export_location
else
echo "set -U $finalVarName $finalVarValue" >> $tide_config_export_location
end
end
end
Result
The content of the exported file is very nice 🙂 :
A similar thing was implemented in Tide v6. Thanks for your effort though :)
hahahhaha
Ok, I should have tried to update it before going hacker mode 😅
I say thank you man! Great project, I love it!