-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor: Organize Bash scripts and introduce centralized configuration
- Moved existing Bash scripts into designated directories for better organization. - Added config.sh to define file paths centrally. - Created load.sh to source all dependencies and script files from the newly defined paths. - Implemented driver.sh to handle user interactions and function invocations. - Ensured load.sh is executed within driver.sh to initialize all configurations and dependencies.
- Loading branch information
1 parent
0d63785
commit 4b13aaf
Showing
11 changed files
with
59 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#CONFIG=~/.ssh/config | ||
CONFIG=~/Projects/luftballon/config # Test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
source load.sh | ||
|
||
function sshConfigManagerUsage() { | ||
echo "Usage: driver <command> [options]" | ||
echo "" | ||
echo "Commands:" | ||
echo " create <name> <host> <user> <port> Create a new SSH configuration" | ||
echo " update <name> <host> <user> <port> Update an existing SSH configuration" | ||
echo " delete <name> Delete an SSH configuration" | ||
echo "" | ||
echo "Options:" | ||
echo " -h, --help Show help information" | ||
} | ||
|
||
function driver() { | ||
|
||
# Check if at least one argument is provided | ||
if [ $# -eq 0 ]; then | ||
sshConfigManagerUsage | ||
fi | ||
|
||
# Execute the appropriate command | ||
case "$1" in | ||
create) | ||
create "${@:2}" | ||
;; | ||
update) | ||
callUpdate "${@:2}" | ||
;; | ||
delete) | ||
delete "${@:2}" | ||
;; | ||
*) | ||
echo "Error: Invalid command." | ||
sshConfigManagerUsage | ||
;; | ||
esac | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
manageConfigPath=$(pwd) | ||
source $manageConfigPath/dependencies/config.sh | ||
source $manageConfigPath/dependencies/array.sh | ||
source $manageConfigPath/dependencies/read.sh | ||
source $manageConfigPath/dependencies/replace.sh | ||
source $manageConfigPath/dependencies/retrieve.sh | ||
|
||
source $manageConfigPath/create.sh | ||
source $manageConfigPath/update.sh | ||
source $manageConfigPath/delete.sh | ||
source $manageConfigPath/callUpdate.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters