move fish functions to omf plugin

pull/2/head
Bruno Pinto 9 years ago
parent 8b35fae1d8
commit 46f0a3f981

3
.gitignore vendored

@ -8,3 +8,6 @@ themes/*
*.sw?
plugins/ta/data/*
# Track oh-my-fish plugin
!plugins/omf/

@ -35,7 +35,7 @@ If you want to install it manually, [click here](https://github.com/bpinto/oh-my
## Usage
Open your fish configuration file `~/.config/fish/config.fish` and specify the theme and the plugins you want to use. And then run `fish install` on your terminal to install them.
Open your fish configuration file `~/.config/fish/config.fish` and specify the theme and the plugins you want to use. And then run `omf install` on your terminal to install them.
Before setting down on a theme, you might want to have a go with all themes using our quick [theme switcher](https://github.com/bpinto/oh-my-fish/blob/master/plugins/theme/README.md) by typing `theme --help` on your shell.

@ -5,7 +5,7 @@ function Plugin --argument-names name
import plugins/$name
else
set_color red
echo "Plugin '$name' is not installed. Run 'fish install' to download and install it."
echo "Plugin '$name' is not installed. Run 'omf install' to download and install it."
set_color normal
end
end

@ -5,7 +5,7 @@ function Theme --argument-names name
import themes/$name
else
set_color red
echo "Theme '$name' is not installed. Run 'fish install' to download and install it."
echo "Theme '$name' is not installed. Run 'omf install' to download and install it."
set_color normal
end
end

@ -28,6 +28,9 @@ end
# repeat for plugins.
import plugins/$fish_plugins themes/$fish_theme
# Always load oh-my-fish plugin
import plugins/omf
# Source all files inside custom directory.
for load in $fish_custom/*.load
. $load

@ -1,20 +1,20 @@
# NAME
# fish - Extend default fish binary
# omf - Oh My Fish helper
#
# DESCRIPTION
# Extend fish binary to support plugins and themes installation
#
function fish -d "Extend fish binary"
function omf -d "Oh My Fish helper"
if test (count $argv) -gt 0
switch $argv[1]
case 'install'
fish.packages --install
omf.packages --install
case 'update'
fish.packages --update
omf.packages --update
case '*'
command fish $argv
omf.helper
end
else
command fish
omf.helper
end
end

@ -0,0 +1,15 @@
# NAME
# omf.helper - Prints Oh My Fish help
#
# DESCRIPTION
# Prints all functions supported by Oh My Fish helper
#
function omf.helper -d 'Prints all functions supported by Oh My Fish helper'
omf.log normal 'Oh My Fish is a package manager for fish shell. This is a'
omf.log normal 'basic help message containing pointers to more information.'
omf.log normal ''
omf.log normal ' Examples:'
omf.log normal ' omf install'
omf.log normal ' omf update'
end

@ -1,5 +1,5 @@
# NAME
# fish.log - simple log with color
# omf.log - simple log with color
#
# SYNOPSIS
# <string> [<string>...]
@ -7,7 +7,7 @@
# DESCRIPTION
# Simply log a message with a specified color.
#
function fish.log -d "Simple log with color"
function omf.log -d "Simple log with color"
switch $argv[1]
case '-*'
echo $argv[1] (set_color $argv[2])$argv[3..-1](set_color normal)

@ -1,8 +1,8 @@
# NAME
# fish.packages - Manage all plugins and themes
# omf.packages - Manage all plugins and themes
#
# SYNOPSIS
# fish.packages [OPTIONS]
# omf.packages [OPTIONS]
#
# OPTIONS
# --install
@ -14,15 +14,15 @@
# Manage all plugins and themes specified on the $fish_plugins
# and $fish_theme variables
#
function fish.packages --argument-names options -d 'Manage all plugins and themes'
function omf.packages --argument-names options -d 'Manage all plugins and themes'
set -l modified_packages 0
switch $options
case "--install"
fish.packages.install
omf.packages.install
case "--update"
fish.packages.update
omf.packages.update
case "*"
fish.log red 'Unknown option'
omf.log red 'Unknown option'
end
end

@ -1,11 +1,11 @@
# NAME
# fish.packages.install - Install all plugins and themes
# omf.packages.install - Install all plugins and themes
#
# DESCRIPTION
# Install all plugins and themes specified on the $fish_plugins
# and $fish_theme variables
#
function fish.packages.install -d "Install all plugins and themes"
function omf.packages.install -d "Install all plugins and themes"
set -l installed_packages 0
# Plugins
@ -13,9 +13,9 @@ function fish.packages.install -d "Install all plugins and themes"
if [ -e $fish_path/plugins/$plugin -o -e $fish_custom/plugins/$plugin ]
#echo "$plugin is already installed. Skipping."
else
fish.log -n white "Installing $plugin... "
omf.log -n white "Installing $plugin... "
git clone "https://github.com/oh-my-fish/plugins-$plugin" $fish_path/plugins/$plugin ^ /dev/null
fish.log green "√"
omf.log green "√"
set -l installed_packages 1
end
end
@ -24,13 +24,13 @@ function fish.packages.install -d "Install all plugins and themes"
if [ -e $fish_path/themes/$fish_theme -o -e $fish_custom/themes/$fish_theme ]
#echo "$fish_theme is already installed. Skipping."
else
fish.log -n white "Installing $fish_theme... "
omf.log -n white "Installing $fish_theme... "
git clone "https://github.com/oh-my-fish/themes-$fish_theme" $fish_path/themes/$fish_theme ^ /dev/null
fish.log green "√"
omf.log green "√"
set -l installed_packages 1
end
if [ $installed_packages -eq 0 ]
fish.log green 'All plugins were already installed.'
omf.log green 'All plugins were already installed.'
end
end

@ -1,26 +1,26 @@
# NAME
# fish.packages.update - Update all plugins and themes
# omf.packages.update - Update all plugins and themes
#
# DESCRIPTION
# Update all plugins and themes specified on the $fish_plugins
# and $fish_theme variables
#
function fish.packages.update -d "Update all plugins and themes"
function omf.packages.update -d "Update all plugins and themes"
set -l installed_packages 0
pushd
# Plugins
for plugin in $fish_plugins
if [ -e $fish_path/plugins/$plugin -a -e $fish_path/plugins/$plugin/.git ]
fish.log -n white "Updating $plugin... "
omf.log -n white "Updating $plugin... "
echo (cd $fish_path/plugins/$plugin; and git pull --rebase > /dev/null) >/dev/null
fish.log green "√"
omf.log green "√"
set -l installed_packages 1
else
if [ -e $fish_custom/plugins/$plugin -a -e $fish_custom/plugins/$plugin/.git ]
fish.log -n white "Updating $plugin... "
omf.log -n white "Updating $plugin... "
echo (cd $fish_custom/plugins/$plugin; and git pull --rebase > /dev/null) >/dev/null
fish.log green "√"
omf.log green "√"
set -l installed_packages 1
else
#echo "$plugin is not installed or not a git repo. Skipping."
@ -30,15 +30,15 @@ function fish.packages.update -d "Update all plugins and themes"
# Theme
if [ -e $fish_path/themes/$fish_theme -a -e $fish_path/themes/$fish_theme/.git ]
fish.log -n white "Updating $fish_theme... "
omf.log -n white "Updating $fish_theme... "
echo (cd $fish_path/themes/$fish_theme; and git pull --rebase > /dev/null) >/dev/null
fish.log green "√"
omf.log green "√"
set -l installed_packages 1
else
if [ -e $fish_custom/themes/$fish_theme -a -e $fish_custom/themes/$fish_theme/.git ]
fish.log -n white "Updating $fish_theme... "
omf.log -n white "Updating $fish_theme... "
echo (cd $fish_custom/themes/$fish_theme; and git pull --rebase > /dev/null) >/dev/null
fish.log green "√"
omf.log green "√"
set -l installed_packages 1
else
#echo "$fish_theme is not installed or not a git repo. Skipping."
@ -46,7 +46,7 @@ function fish.packages.update -d "Update all plugins and themes"
end
if [ $installed_packages -eq 0 ]
fish.log green 'No plugins to update.'
omf.log green 'No plugins to update.'
end
popd
Loading…
Cancel
Save