Make default theme the default theme for omf.

* On clean install, configure and download `default` theme.
* Do not allow `default` theme to be removed.
* When the current theme is removed, fallback to `default`.
This commit is contained in:
Bruno Pinto 2015-09-01 12:38:32 +01:00
parent 0e035c0a85
commit 7dad917436
3 changed files with 6 additions and 5 deletions

View File

@ -99,8 +99,8 @@ omf_install() {
if [ ! -d "${OMF_CONFIG}" ]; then if [ ! -d "${OMF_CONFIG}" ]; then
echo "Writing Oh My Fish configuration → ${OMF_CONFIG}" echo "Writing Oh My Fish configuration → ${OMF_CONFIG}"
mkdir -p "${OMF_CONFIG}" mkdir -p "${OMF_CONFIG}"
touch "${OMF_CONFIG}/theme" test -f "${OMF_CONFIG}/bundle" || echo "theme default" > "${OMF_CONFIG}/bundle"
touch "${OMF_CONFIG}/bundle" test -f "${OMF_CONFIG}/theme" || echo default > "${OMF_CONFIG}/theme"
test -f "${OMF_CONFIG}/revision" || echo ${git_rev} > "${OMF_CONFIG}/revision" test -f "${OMF_CONFIG}/revision" || echo ${git_rev} > "${OMF_CONFIG}/revision"
else else
fish -c "omf install" fish -c "omf install"

View File

@ -27,8 +27,8 @@ function omf.remove_package
set -l remove_status 1 set -l remove_status 1
if not omf.util_valid_package $pkg if not omf.util_valid_package $pkg
if test $pkg = "omf" if test $pkg = "omf" -o $pkg = "default"
echo (omf::err)"You can't remove `omf`"(omf::off) 1^&2 echo (omf::err)"You can't remove `$pkg`"(omf::off) 1^&2
else else
echo (omf::err)"$pkg is not a valid package/theme name"(omf::off) 1^&2 echo (omf::err)"$pkg is not a valid package/theme name"(omf::off) 1^&2
end end
@ -49,7 +49,7 @@ function omf.remove_package
not test -d $path; and continue not test -d $path; and continue
if test $pkg = (cat $OMF_CONFIG/theme) if test $pkg = (cat $OMF_CONFIG/theme)
echo "" > $OMF_CONFIG/theme echo default > $OMF_CONFIG/theme
end end
_remove_from_bundle "theme" $pkg _remove_from_bundle "theme" $pkg

View File

@ -1,5 +1,6 @@
function omf.util_valid_package -a package function omf.util_valid_package -a package
test (echo "$package" | tr "[:upper:]" "[:lower:]") = "omf"; and return 10 test (echo "$package" | tr "[:upper:]" "[:lower:]") = "omf"; and return 10
test (echo "$package" | tr "[:upper:]" "[:lower:]") = "default"; and return 10
switch $package switch $package
case {a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}\* case {a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}\*
switch $package switch $package