-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup
More file actions
executable file
·91 lines (80 loc) · 2.24 KB
/
Copy pathsetup
File metadata and controls
executable file
·91 lines (80 loc) · 2.24 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/usr/bin/env bash
# devsetup — automate local app setup + git setup.
set -euo pipefail
DEVSETUP_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
export DEVSETUP_DIR
# shellcheck source=lib/common.sh
source "$DEVSETUP_DIR/lib/common.sh"
usage() {
cat <<EOF
devsetup — automate local application setup and git setup
Usage: setup <command> [args]
Commands:
git config Configure global git user, editor, default branch, aliases
git keys Generate/check SSH key, optionally set up GPG commit signing
git auth Ensure GitHub CLI (gh) is installed and authenticated
git init [path] Initialize a new repo (default: cwd) with a .gitignore + first commit
git clone <url> [dir] Clone an existing repo
local [path] Detect a project's type in path (default: cwd) and install its dependencies
all [path] Run git config, git keys, git auth, then local setup for path
-h, --help Show this help
EOF
}
main() {
local cmd="${1:-}"
case "$cmd" in
git)
local sub="${2:-}"
case "$sub" in
config)
source "$DEVSETUP_DIR/lib/git-config.sh"
git_config_setup
;;
keys)
source "$DEVSETUP_DIR/lib/git-keys.sh"
git_keys_setup
;;
auth)
source "$DEVSETUP_DIR/lib/git-auth.sh"
git_auth_setup
;;
init)
source "$DEVSETUP_DIR/lib/git-repo.sh"
git_repo_init "${3:-.}"
;;
clone)
source "$DEVSETUP_DIR/lib/git-repo.sh"
git_repo_clone "${3:-}" "${4:-}"
;;
*)
usage
exit 1
;;
esac
;;
local)
source "$DEVSETUP_DIR/lib/local-deps.sh"
local_deps_setup "${2:-.}"
;;
all)
local target="${2:-.}"
source "$DEVSETUP_DIR/lib/git-config.sh"
source "$DEVSETUP_DIR/lib/git-keys.sh"
source "$DEVSETUP_DIR/lib/git-auth.sh"
source "$DEVSETUP_DIR/lib/local-deps.sh"
git_config_setup
git_keys_setup
git_auth_setup
local_deps_setup "$target"
;;
-h|--help|"")
usage
;;
*)
log_error "Unknown command: $cmd"
usage
exit 1
;;
esac
}
main "$@"