-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgitpersona-manager
executable file
·59 lines (55 loc) · 1.53 KB
/
gitpersona-manager
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/env bash
PYTHON_SCRIPT="$GITPERSONA_PATH/main.py"
# Check if any argument is provided
if [ "$#" -lt 1 ]; then
echo "Usage: $0 <command> [<args>]"
echo "Commands:"
echo " add <name> <email> Add a new identity"
echo " remove <name> Remove an existing identity"
echo " list List all identities"
echo " clone <repository-url> Clone a repository"
echo " edit Edit an existing identity"
echo " switch Switches the identity used in the repository in the current directory"
exit 1
fi
# Parse the command
command=$1
shift
# Call the appropriate function based on the command
case "$command" in
add)
if [ "$#" -ne 2 ]; then
echo "Usage: $0 add <name> <email>"
exit 1
fi
python3 "$PYTHON_SCRIPT" add "$1" "$2"
;;
remove)
if [ "$#" -ne 1 ]; then
echo "Usage: $0 remove <name>"
exit 1
fi
python3 "$PYTHON_SCRIPT" remove "$1"
;;
edit)
python3 "$PYTHON_SCRIPT" edit
;;
list)
python3 "$PYTHON_SCRIPT" list
;;
clone)
if [ "$#" -ne 1 ]; then
echo "Usage: $0 clone <repository-url> <directory: optional>"
exit 1
fi
python3 "$PYTHON_SCRIPT" clone "$@"
;;
switch)
python3 "$PYTHON_SCRIPT" switch .
;;
*)
echo "Unknown command: $command"
echo "Usage: $0 <command> [<args>]"
exit 1
;;
esac