Skip to content

Commit

Permalink
Merge pull request #17 from Rynaro/fix/plugins/manage-scaffolding-fix
Browse files Browse the repository at this point in the history
Fix plugins scaffolding callers
  • Loading branch information
Rynaro authored Jul 1, 2024
2 parents a110c81 + 7dedc42 commit b31032a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion plugins.sh
Original file line number Diff line number Diff line change
@@ -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 "$@"
Expand Down
13 changes: 6 additions & 7 deletions plugins/generators.sh
Original file line number Diff line number Diff line change
@@ -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 <plugin_name>"
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
Expand All @@ -19,14 +22,10 @@ manage_plugins() {

case $action in
create)
scaffold_plugin "$plugin_name"
scaffold_plugin $plugin_name
;;
*)
echo "Usage: $0 create <plugin_name>"
;;
esac
}

# Execute the manage_plugins function with provided arguments
manage_plugins "$@"

4 changes: 2 additions & 2 deletions plugins/manage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ PLUGINS_DIR="plugins"

source "$(dirname "$0")/packages/accessories.sh"


# Main function to manage plugins
manage_plugins() {
local action=$1
Expand All @@ -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 <plugin_name>}"
Expand Down
3 changes: 0 additions & 3 deletions plugins/scaffold_plugin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 "$@"

0 comments on commit b31032a

Please sign in to comment.