oh-my-fish/pkg/omf/cli/omf_new.fish
Justin Hileman 0359ba047c Merge $OMF_CONFIG and $OMF_CUSTOM.
Per conversation with @bpinto in Gitter.

There's no need for two separate directories. You don't have a `.git` and `.git-custom` folder, you just put your config in `.git` :)

The most straightforward interpretation of XDG basedir spec is that user configuration for omf would go in `~/.config/omf`, so let's put it there. The only question is whether omf-generated config (i.e. the `theme` file) should go there as well. By analogy with git, programmatically generated config should probably be merged in with user config. This also makes it so when a user clones their dotfiles to a new machine, both kinds of settings come with it.
2015-08-27 11:02:30 -07:00

35 lines
960 B
Fish

function omf_new -a option name
switch $option
case "p" "pkg" "pack" "packg" "package"
set option "pkg"
case "t" "th" "the" "thm" "theme" "themes"
set option "themes"
case "*"
echo (omf::err)"$option is not a valid option."(omf::off) 1^&2
return $OMF_INVALID_ARG
end
if not omf_util_valid_package "$name"
echo (omf::err)"$name is not a valid package/theme name"(omf::off) 1^&2
return $OMF_INVALID_ARG
end
if set -l dir (omf_util_mkdir "$option/$name")
cd $dir
set -l github (git config github.user)
test -z "$github"; and set github "{{USER}}"
set -l user (git config user.name)
test -z "$user"; and set user "{{USER}}"
omf_new_from_template "$OMF_PATH/pkg/omf/templates/$option" \
$github $user $name
echo (omf::em)"Switched to $dir"(omf::off)
else
echo (omf::err)"\$OMF_CONFIG and/or \$OMF_PATH undefined."(omf::off) 1^&2
exit $OMF_UNKNOWN_ERR
end
end