-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathnew-python-project
More file actions
executable file
·42 lines (34 loc) · 1.08 KB
/
new-python-project
File metadata and controls
executable file
·42 lines (34 loc) · 1.08 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
#!/bin/bash
function show_usage() {
echo "Basic usage: $0 <project_name>"
exit 0
}
# argument parsing
# see: https://stackoverflow.com/questions/192249/how-do-i-parse-command-line-arguments-in-bash
POSITIONAL=()
while [[ $# -gt 0 ]] ; do
key="$1"
case $key in
-h)
show_usage
;;
*) # unknown option
POSITIONAL+=("$1") # save it in an array for later
shift # past argument
;;
esac
done
set -- "${POSITIONAL[@]}" # restore positional parameters
project_name="${POSITIONAL[0]}"
[[ -z $project_name ]] && show_usage
dir_template="false"
[[ -d "${HOME}/tools/miSCripts" ]] && dir_template="${HOME}/tools/miSCripts"
[[ -d "${HOME}/git/miSCripts" ]] && dir_template="${HOME}/git/miSCripts"
[[ -d "${HOME}/git/yaap7/miSCripts" ]] && dir_template="${HOME}/git/yaap7/miSCripts"
if [[ "x$dir_template" == "xfalse" ]] ; then
echo "miSCripts repo not found" >&2
exit 1
fi
mkdir "$project_name"
cp -r "${dir_template}"/template_python_git/* "${project_name}/"
cp -r "${dir_template}"/template_python_git/.* "${project_name}/"