Skip to content

Commit

Permalink
note: clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
akinomyoga committed Dec 8, 2020
1 parent 276baf2 commit ad843b4
Show file tree
Hide file tree
Showing 7 changed files with 9,731 additions and 9,673 deletions.
2 changes: 1 addition & 1 deletion GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ MWGPP:=$(GAWK) -f ext/mwg_pp.awk
#------------------------------------------------------------------------------
# ble.sh

FULLVER:=0.4.0-devel2
FULLVER:=0.4.0-devel3

OUTDIR:=out

Expand Down
87 changes: 0 additions & 87 deletions generate-release-note.sh

This file was deleted.

154 changes: 126 additions & 28 deletions make_command.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,30 @@ function mkd {
[[ -d $1 ]] || mkdir -p "$1"
}

function ble/array#push {
while (($#>=2)); do
builtin eval "$1[\${#$1[@]}]=\$2"
set -- "$1" "${@:3}"
done
}

#------------------------------------------------------------------------------

function sub:help {
printf '%s\n' \
'usage: make_command.sh SUBCOMMAND args...' \
'' 'SUBCOMMAND' ''
local sub
for sub in $(declare -F | sed -n 's|^declare -[fx]* sub:\([^/]*\)$|\1|p'); do
if declare -f sub:"$sub"/help &>/dev/null; then
sub:"$sub"/help
else
printf ' %s\n' "$sub"
fi
done
printf '\n'
}

function sub:install {
# read options
local flag_error= flag_release=
Expand Down Expand Up @@ -56,31 +80,26 @@ function sub:ignoreeof-messages {
) >| lib/core-edit.ignoreeof-messages.new
}

function sub:help {
printf '%s\n' \
'usage: make_command.sh SUBCOMMAND args...' \
'' 'SUBCOMMAND' ''
local sub
for sub in $(declare -F | sed -n 's|^declare -[fx]* sub:\([^/]*\)$|\1|p'); do
if declare -f sub:"$sub"/help &>/dev/null; then
sub:"$sub"/help
else
printf ' %s\n' "$sub"
fi
#------------------------------------------------------------------------------
# sub:check
# sub:check-all

function sub:check {
bash out/ble.sh --test
}
function sub:check-all {
local -x _ble_make_command_check_count=0
local bash rex_version='^bash-([0-9]+)\.([0-9]+)$'
for bash in $(compgen -c -- bash- | grep -E '^bash-[0-9]+\.[0-9]+$' | sort -Vr); do
[[ $bash =~ $rex_version && ${BASH_REMATCH[1]} -ge 3 ]] || continue
"$bash" out/ble.sh --test || return 1
((_ble_make_command_check_count++))
done
printf '\n'
}

#------------------------------------------------------------------------------
# sub:scan

function ble/array#push {
while (($#>=2)); do
builtin eval "$1[\${#$1[@]}]=\$2"
set -- "$1" "${@:3}"
done
}

function sub:scan/grc-source {
local -a options=(--color --exclude=./{test,memo,ext,wiki,contrib,[TD]????.*} --exclude=\*.{md,awk} --exclude=./make_command.sh)
grc "${options[@]}" "$@"
Expand Down Expand Up @@ -301,20 +320,97 @@ function sub:scan {
}

#------------------------------------------------------------------------------
# sub:release-note
#
# 使い方
# ./make_command.sh release-note v0.3.2..v0.3.3

function sub:check {
bash out/ble.sh --test
function sub:release-note/help {
printf ' release-note v0.3.2..v0.3.3 [--changelog CHANGELOG]\n'
}
function sub:check-all {
local -x _ble_make_command_check_count=0
local bash rex_version='^bash-([0-9]+)\.([0-9]+)$'
for bash in $(compgen -c -- bash- | grep -E '^bash-[0-9]+\.[0-9]+$' | sort -Vr); do
[[ $bash =~ $rex_version && ${BASH_REMATCH[1]} -ge 3 ]] || continue
"$bash" out/ble.sh --test || return 1
((_ble_make_command_check_count++))

function sub:release-note/read-arguments {
flags=
fname_changelog=memo/ChangeLog.md
while (($#)); do
local arg=$1; shift 1
case $arg in
(--changelog)
if (($#)); then
fname_changelog=$1; shift
else
flags=E$flags
echo "release-note: missing option argument for '$arg'." >&2
fi ;;
esac
done
}

function sub:release-note/.find-commit-pairs {
{
echo __MODE_HEAD__
git log --format=format:'%h%s' --date-order --abbrev-commit "$1"; echo
echo __MODE_MASTER__
git log --format=format:'%h%s' --date-order --abbrev-commit master; echo
} | awk -F '' '
/^__MODE_HEAD__$/ {
mode = "head";
nlist = 0;
next;
}
/^__MODE_MASTER__$/ { mode = "master"; next; }
mode == "head" {
i = nlist++;
titles[i] = $2
commit_head[i] = $1;
title2index[$2] = i;
}
mode == "master" && (i = title2index[$2]) != "" && commit_master[i] == "" {
commit_master[i] = $1;
}
END {
for (i = 0; i < nlist; i++) {
print commit_head[i] ":" commit_master[i] ":" titles[i];
}
}
'
}

function sub:release-note {
local flags fname_changelog
sub:release-note/read-arguments "$@"

## @arr commits
## この配列は after:before の形式の要素を持つ。
## 但し after は前の version から release までに加えられた変更の commit である。
## そして before は after に対応する master における commit である。
local -a commits
IFS=$'\n' eval 'commits=($(sub:release-note/.find-commit-pairs "$@"))'

local commit_pair
for commit_pair in "${commits[@]}"; do
local a=${commit_pair%%:*}
commit_pair=${commit_pair:${#a}+1}
local b=${commit_pair%%:*}
local c=${commit_pair#*:}

local result=
[[ $b ]] && result=$(awk '
sub(/^##+ +/, "") { heading = "[" $0 "] "; next; }
sub(/\y'"$b"'\y/, "'"$a (master: $b)"'") {print heading $0;}
' "$fname_changelog")
if [[ $result ]]; then
echo "$result"
elif [[ $c ]]; then
echo "- $c $a (master: ${b:-N/A}) ■NOT-FOUND■"
else
echo "■not found $a"
fi
done | tac
}

#------------------------------------------------------------------------------

function sub:list-functions/help {
Expand Down Expand Up @@ -407,6 +503,8 @@ function sub:check-readline-bindable {
) <(sort keymap/emacs.rlfunc.txt)
}

#------------------------------------------------------------------------------

if (($#==0)); then
sub:help
elif declare -f sub:"$1" &>/dev/null; then
Expand Down
17 changes: 15 additions & 2 deletions memo/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
<!---------------------------------------------------------------------------->
# ble-0.4.0-devel3

2020-12-02 -- (`#D1427`...) 276baf2...

## New features

## Changes

## Fixes

## Internal changes and fixes

<!---------------------------------------------------------------------------->
# ble-0.4.0-devel2

2020-01-12 -- 2020-12-02 (`#D1215`...`#D1426`) c74abc5...
2020-01-12 -- 2020-12-02 (`#D1215`...`#D1426`) c74abc5...276baf2

## New features

Expand Down Expand Up @@ -48,7 +61,7 @@
- syntax: support options `bleopt highlight_{syntax,filename,vartype}` to turn off highlighting (requested by pjmp) `#D1379` 0116f8b
- complete: support `shopt progcomp_alias` `#D1397` d68afa5
- complete: generate completions of options based on man pages `#D1405` 8183455
- complete (mandb): fix a bug that `bleopt complete_menu_style` is globally changed `#D1412` b91fd10
- complete (mandb): fix a bug that `bleopt complete_menu_style` is globally changed `#D1412` b91fd10
- highlight: support colon separated lists of paths `#D1409` 2f40422
- highlight: fix a bug that non-simple words are always highlighted as `syntax_error` (reported by cmplstofB) `#D1411` 46e2ac6
- highlight: fix a bug that words are sometimes unhighlighted `#D1418` 4395484
Expand Down
10 changes: 5 additions & 5 deletions memo/Release.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# ble-0.3.3

## New
## New features

- prompt: fix a bug that rprompt is not cleared when `bleopt prompt_rps1` is reset `#D1377` c736bd5 (master: 1904b1d)
- syntax: allow unquoted `[!` and `[^` in `simple-word` (reported by cmplstofB) `#D1303` 4bf8b86 (master: 1efe833)
- highlight: fix unhighlighted tilde expansions `~+` (reported by cmplstofB) `#D1424` 1f9abf6 (master: a32962e)

## Changes

Expand Down Expand Up @@ -40,6 +38,7 @@
- main: fix problems caused by multiple `source ble.sh` in bashrc `#D1354` 983e8a9 (master: 5476933)
- syntax: allow single-character variable name in named redirections `{a}<>` `#D1360` 52de342 (master: 4760409)
- decode (`bind`): work around `shopt -s nocasematch` (reported by tigger04) `#D1372` b34ad58 (master: 855cacf)
- prompt: fix a bug that rprompt is not cleared when `bleopt prompt_rps1` is reset `#D1377` c736bd5 (master: 1904b1d)
- complete: fix a bug of duplicated completions of filenames with spaces `#D1390` 048f17e (master: 98576c7)
- complete: fix bugs that quotation disappears on ambiguous completion `#D1387` 048f17e (master: 98576c7)
- complete: fix a bug that progcomp retry by 124 caused the default completion again `#D1386` 048f17e (master: 98576c7)
Expand All @@ -50,6 +49,7 @@
- syntax (glob bracket expression): fix a bug of unsupported POSIX brackets `#D1402` e1eca65 (master: 6fd9e22)
- syntax (`ble/syntax:bash/simple-word/evaluate-path-spec`): fix a bug of unrecognized `[!...]` and `[^...]` `#D1403` 50fcd03 (master: 0b842f5)
- highlight: fix remaininig highlighting of vanishing words `#D1421` `#D1422` 0f85719 (master: 1066653)
- highlight: fix unhighlighted tilde expansions `~+` (reported by cmplstofB) `#D1424` 1f9abf6 (master: a32962e)
- complete: fix a problem that the user setting `dotglob` is changed `#D1425` e26867d (master: 987436d)
- complete: fix a problem of redundant unmatched ambiguous part with tilde expansions in the common prefix `#D1417` 20cb6af (master: 5777d7f)
- complete (`source:file`): fix a bug that tilde expansion candidates are always filtered out `#D1416` 20cb6af (master: 5777d7f)
Expand Down Expand Up @@ -82,10 +82,9 @@
-------------------------------------------------------------------------------
# ble-0.2.6

## New
## New features

- syntax: allow unquoted `[!` and `[^` in `simple-word` (reported by cmplstofB) `#D1303` 5cff40f (master: 1efe833)
- highlight: fix unhighlighted tilde expansions `~+` (reported by cmplstofB) `#D1424` 3f7f044 (master: a32962e)

## Changes

Expand All @@ -108,6 +107,7 @@
- syntax: allow single-character variable name in named redirections `{a}<>` `#D1360` f81734f (master: 4760409)
- syntax (glob bracket expression): fix a bug of unsupported POSIX brackets `#D1402` b7ea892 (master: 6fd9e22)
- highlight: fix remaininig highlighting of vanishing words `#D1421` `#D1422` cc5e4d1 (master: 1066653)
- highlight: fix unhighlighted tilde expansions `~+` (reported by cmplstofB) `#D1424` 3f7f044 (master: a32962e)

## Compatibility

Expand Down

0 comments on commit ad843b4

Please sign in to comment.