diff --git a/plugins.sh b/plugins.sh index 22f65d5..4109dc3 100755 --- a/plugins.sh +++ b/plugins.sh @@ -1,7 +1,7 @@ #!/bin/bash source "$(dirname "$0")/packages/accessories.sh" -safe_source 'plugins/manage.sh' +safe_source 'plugins/manage.sh' # Execute the manage_plugins function with provided arguments manage_plugins "$@" diff --git a/plugins/generators.sh b/plugins/generators.sh index d7be056..7969b81 100755 --- a/plugins/generators.sh +++ b/plugins/generators.sh @@ -1,15 +1,18 @@ #!/bin/bash +source "$(dirname "$0")/packages/accessories.sh" + # Function to scaffold a new plugin scaffold_plugin() { local plugin_name=$1 - if [ -z "$plugin_name" ]; then + if [ -z $plugin_name ]; then echo "Usage: $0 create " exit 1 fi - bash "$(dirname "$0")/scaffold_plugin.sh" "$plugin_name" + safe_source "$(dirname "$0")/plugins/scaffold_plugin.sh" + create_plugin $plugin_name } # Main function to manage plugins @@ -19,14 +22,10 @@ manage_plugins() { case $action in create) - scaffold_plugin "$plugin_name" + scaffold_plugin $plugin_name ;; *) echo "Usage: $0 create " ;; esac } - -# Execute the manage_plugins function with provided arguments -manage_plugins "$@" - diff --git a/plugins/manage.sh b/plugins/manage.sh index 16b4aa7..906d946 100755 --- a/plugins/manage.sh +++ b/plugins/manage.sh @@ -4,7 +4,6 @@ PLUGINS_DIR="plugins" source "$(dirname "$0")/packages/accessories.sh" - # Main function to manage plugins manage_plugins() { local action=$1 @@ -18,7 +17,8 @@ manage_plugins() { install_plugins ;; create) - safe_source "$(dirname "$0")/plugins/generators.sh" create "$plugin_name" + safe_source "$(dirname "$0")/plugins/generators.sh" + manage_plugins create $plugin_name ;; *) echo "Usage: $0 {install|create }" diff --git a/plugins/scaffold_plugin.sh b/plugins/scaffold_plugin.sh index 70c1219..aecd538 100755 --- a/plugins/scaffold_plugin.sh +++ b/plugins/scaffold_plugin.sh @@ -87,6 +87,3 @@ EOL echo "Plugin $plugin_name has been created at $plugin_dir" } - -# Execute the create_plugin function with provided arguments -create_plugin "$@"