Extracting template to a file and improving it

It's hard to read the template as it was being created using `echo`
instead of being defined on a separate file. Also adding some comments
to improve the configuration file readability.
This commit is contained in:
Bruno Pinto 2015-08-28 12:53:37 +01:00
parent 5654170b93
commit 7c5e2b3964
2 changed files with 15 additions and 4 deletions

View File

@ -92,10 +92,8 @@ omf_install() {
touch ${fish_config_file} >/dev/null 2>&1
test ! -w ${fish_config_file} && die "Fish configuration file is not writable, aborting."
echo "set -g OMF_PATH $(echo "${OMF_PATH}" | sed -e "s|$HOME|\$HOME|")" > ${fish_config_file}
echo "set -g OMF_CONFIG $(echo "${OMF_CONFIG}" | sed -e "s|$HOME|\$HOME|")" >> ${fish_config_file}
echo "source \$OMF_PATH/init.fish" >> ${fish_config_file}
sed "s|{{OMF_PATH}}|$OMF_PATH|;s|{{OMF_CONFIG}}|$OMF_CONFIG|" \
"${OMF_PATH}/templates/config.fish" > "${fish_config_file}"
if [ ! -d "${OMF_CONFIG}" ]; then
echo "Writing Oh My Fish configuration → ${OMF_CONFIG}"

13
templates/config.fish Normal file
View File

@ -0,0 +1,13 @@
# Path to your oh-my-fish.
set -g OMF_PATH {{OMF_PATH}}
# Path to your oh-my-fish configuration.
set -g OMF_CONFIG {{OMF_CONFIG}}
### Configuration required to load oh-my-fish ###
# Note: Only add configurations that are required to be set before oh-my-fish is loaded.
# For common configurations, we advise you to add them to your $OMF_CONFIG/init.fish file or
# to create a custom plugin instead.
# Load oh-my-fish configuration.
source $OMF_PATH/init.fish