Skip to content

Commit

Permalink
refactor arg parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
adamtabrams committed Aug 30, 2024
1 parent 3449fc2 commit c45c548
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions change
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ post_command() {
-H "Authorization: token $auth_token" \
-H "Content-Type: application/json" \
-d "{\"tag_name\": \"$top_tag\", \"name\": \"$top_tag\", \"body\": \"$body\" }"
# --data-urlencode "=$data"
# --data-urlencode "=$data"
}

init_command() {
Expand Down Expand Up @@ -390,30 +390,29 @@ update_command() {
bump_version
}

# TODO: refactor
# TODO: add prompt
all_command() {
backup=$(cat $log_file)
update_command || return 1

last_changed=$(stat -qf "%Sc" $log_file)
last_changed=$(stat -qf '%Sc' $log_file)
${EDITOR:-vi} $log_file
[ $(stat -qf "%Sc" $log_file) = $last_changed ] &&
[ "$(stat -qf '%Sc' $log_file)" = "$last_changed" ] &&
echo "cancelling because no manual edits were made to $log_file" >&2 &&
echo "$backup" >$log_file &&
return 1

bump_version
push_tag="true"
push_tag='true'
git add $log_file &&
git commit --quiet -m "docs: update changelog" && git push --quiet &&
git commit --quiet -m 'docs: update changelog' && git push --quiet &&
tag_and_push && post_command
}

#### Args ####

# TODO: refactor
command=$1
[ "$(expr "$command" : '-.*')" != 0 ] && command=''
[ "${command#-}" != "$command" ] && command=''
[ "$command" ] && shift

while [ $# != 0 ]; do
Expand Down

0 comments on commit c45c548

Please sign in to comment.