mirror of
https://github.com/m-housh/dotfiles.git
synced 2026-02-14 06:12:34 +00:00
feat: Adds '--date' option to hpa-create script to allow date override when generating a new project.
This commit is contained in:
11
env/.local/scripts/utils/hpa/hpa-create
vendored
11
env/.local/scripts/utils/hpa/hpa-create
vendored
@@ -17,9 +17,10 @@ LOG_FILE=${LOG_FILE:-"$LOG_LABEL.log"}
|
||||
# Load environment / shared variables.
|
||||
. "$SCRIPTS/utils/hpa/hpa.env"
|
||||
|
||||
declare no_git_flag no_push_flag
|
||||
declare no_git_flag no_push_flag date_opt
|
||||
no_git_flag="0"
|
||||
no_push_flag="0"
|
||||
date_opt=$(date '+%Y.%m.%d')
|
||||
|
||||
usage() {
|
||||
cat <<EOF
|
||||
@@ -40,8 +41,9 @@ USAGE:
|
||||
$ $THIS <flags> <customer>
|
||||
|
||||
FLAGS:
|
||||
-h | --help: Show this help page.
|
||||
-d | --date: Override the date the project was started.
|
||||
-g | --no-git: Do not initialize a git repository for the project.
|
||||
-h | --help: Show this help page.
|
||||
-p | --no-push: Do not push project to remote repository.
|
||||
|
||||
ENVIRONMENT:
|
||||
@@ -74,7 +76,7 @@ create() {
|
||||
log "Generating project for: '$customer'"
|
||||
|
||||
container_dir=$(
|
||||
"$SCRIPTS/hpa" create --quiet "/consults/$(date '+%Y.%m.%m').$customer"
|
||||
"$SCRIPTS/hpa" create --quiet "/consults/$date_opt.$customer"
|
||||
)
|
||||
echo "$HPA_CONSULTS_DIR/$(basename "$container_dir")"
|
||||
}
|
||||
@@ -124,6 +126,9 @@ declare customer output
|
||||
while [[ $# -gt 0 ]]; do
|
||||
if [[ $1 == "-h" ]] || [[ $1 == "--help" ]]; then
|
||||
usage && exit 0
|
||||
elif [[ $1 == "-d" ]] || [[ $1 == "--date" ]]; then
|
||||
shift
|
||||
date_opt="$1"
|
||||
elif [[ $1 == "-g" ]] || [[ $1 == "--no-git" ]]; then
|
||||
no_git_flag="1"
|
||||
elif [[ $1 == "-p" ]] || [[ $1 == "--no-push" ]]; then
|
||||
|
||||
Reference in New Issue
Block a user