From 1ab8a20b8cc40ef31978ccdd501be3a86952adaf Mon Sep 17 00:00:00 2001 From: Bruno Pinto Date: Sat, 3 Oct 2015 22:15:40 +0100 Subject: [PATCH] Fix #8: Fishy plugin template --- lib/require.fish | 2 +- pkg/omf/templates/pkg/functions/{{NAME}}.fish | 10 ++++++++++ pkg/omf/templates/pkg/init.fish | 3 +++ pkg/omf/templates/pkg/uninstall.fish | 3 +++ pkg/omf/templates/pkg/{{NAME}}.fish | 18 ------------------ 5 files changed, 17 insertions(+), 19 deletions(-) create mode 100644 pkg/omf/templates/pkg/functions/{{NAME}}.fish create mode 100644 pkg/omf/templates/pkg/init.fish create mode 100644 pkg/omf/templates/pkg/uninstall.fish delete mode 100644 pkg/omf/templates/pkg/{{NAME}}.fish diff --git a/lib/require.fish b/lib/require.fish index 7069559..bba9914 100644 --- a/lib/require.fish +++ b/lib/require.fish @@ -16,7 +16,7 @@ function require -a name and return 0 for path in {$OMF_PATH,$OMF_CONFIG}/pkg/$name - if autoload $path $path/completions + if autoload $path $path/functions $path/completions source $path/init.fish ^/dev/null; or source $path/$name.fish ^/dev/null; diff --git a/pkg/omf/templates/pkg/functions/{{NAME}}.fish b/pkg/omf/templates/pkg/functions/{{NAME}}.fish new file mode 100644 index 0000000..a7eb4a1 --- /dev/null +++ b/pkg/omf/templates/pkg/functions/{{NAME}}.fish @@ -0,0 +1,10 @@ +# SYNOPSIS +# {{NAME}} [options] +# +# USAGE +# Options +# + +function {{NAME}} -d "My package" +end + diff --git a/pkg/omf/templates/pkg/init.fish b/pkg/omf/templates/pkg/init.fish new file mode 100644 index 0000000..04db771 --- /dev/null +++ b/pkg/omf/templates/pkg/init.fish @@ -0,0 +1,3 @@ +function init -a path --on-event init_{{NAME}} +end + diff --git a/pkg/omf/templates/pkg/uninstall.fish b/pkg/omf/templates/pkg/uninstall.fish new file mode 100644 index 0000000..d01e226 --- /dev/null +++ b/pkg/omf/templates/pkg/uninstall.fish @@ -0,0 +1,3 @@ +function uninstall --on-event uninstall_{{NAME}} +end + diff --git a/pkg/omf/templates/pkg/{{NAME}}.fish b/pkg/omf/templates/pkg/{{NAME}}.fish deleted file mode 100644 index cc8bb8d..0000000 --- a/pkg/omf/templates/pkg/{{NAME}}.fish +++ /dev/null @@ -1,18 +0,0 @@ -# SYNOPSIS -# {{NAME}} [options] -# -# USAGE -# Options -# - -function init -a path --on-event init_{{NAME}} - -end - -function {{NAME}} -d "My package" - -end - -function uninstall --on-event uninstall_{{NAME}} - -end