@mihairo/cmt 1.1.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/cmt +20 -24
- package/package.json +1 -1
- package/schema/cmt.schema.json +4 -4
package/README.md
CHANGED
|
@@ -124,7 +124,7 @@ validate it automatically — no extension needed.
|
|
|
124
124
|
```json
|
|
125
125
|
{
|
|
126
126
|
"$schema": "https://raw.githubusercontent.com/mihai-ro/cmt/main/schema/cmt.schema.json",
|
|
127
|
-
"version": "1.
|
|
127
|
+
"version": "1.1.0",
|
|
128
128
|
"customTypes": [
|
|
129
129
|
{
|
|
130
130
|
"type": "wip",
|
package/cmt
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
# =============================================================================
|
|
7
7
|
set -euo pipefail
|
|
8
8
|
|
|
9
|
-
CC_VERSION="1.
|
|
9
|
+
CC_VERSION="1.1.2"
|
|
10
10
|
CC_CONFIG_FILE=".cmt.json"
|
|
11
11
|
CC_SCHEMA_URL="https://raw.githubusercontent.com/mihai-ro/cmt/main/schema/cmt.schema.json"
|
|
12
12
|
|
|
@@ -235,7 +235,7 @@ _pick() {
|
|
|
235
235
|
_old=$(stty -g <&9 2>/dev/null) || { exec 9>&-; _pick_fallback "$_var" "$_prompt" "${_items[@]}"; return; }
|
|
236
236
|
stty -echo -icanon min 1 time 0 <&9 2>/dev/null || { exec 9>&-; _pick_fallback "$_var" "$_prompt" "${_items[@]}"; return; }
|
|
237
237
|
|
|
238
|
-
trap "stty '$_old' <&9 2>/dev/null; printf '\033[?25h' >&9 2>/dev/null; exec 9>&-" EXIT INT TERM
|
|
238
|
+
trap "trap - EXIT INT TERM; stty '$_old' <&9 2>/dev/null; printf '\033[?25h' >&9 2>/dev/null; exec 9>&- 2>/dev/null" EXIT INT TERM
|
|
239
239
|
|
|
240
240
|
_pick_move_up() {
|
|
241
241
|
_cur=$(( (_cur - 1 + _n) % _n ))
|
|
@@ -263,13 +263,10 @@ _pick() {
|
|
|
263
263
|
local _i _end
|
|
264
264
|
_end=$(( _top + _view ))
|
|
265
265
|
[[ $_end -gt $_n ]] && _end=$_n
|
|
266
|
-
local _visible=$(( _end - _top ))
|
|
267
266
|
|
|
268
|
-
# scroll hint above
|
|
267
|
+
# scroll hint above — only when items are hidden above
|
|
269
268
|
if [[ $_top -gt 0 ]]; then
|
|
270
269
|
printf " ${MUTED}↑ %d more${RESET}\033[K\n" "$_top" >&9
|
|
271
|
-
else
|
|
272
|
-
printf "\033[K\n" >&9
|
|
273
270
|
fi
|
|
274
271
|
|
|
275
272
|
for (( _i=_top; _i<_end; _i++ )); do
|
|
@@ -289,11 +286,9 @@ _pick() {
|
|
|
289
286
|
fi
|
|
290
287
|
}
|
|
291
288
|
|
|
292
|
-
# total drawn lines = _view items + 2 hint lines — fixed for this pick session
|
|
293
|
-
local _dl=$(( _view < _n ? _view + 2 : _n + 2 ))
|
|
294
|
-
|
|
295
289
|
printf "\033[?25l" >&9
|
|
296
290
|
printf "\n ${ACCENT_BOLD}%s${RESET}\n\n" "$_prompt" >&9
|
|
291
|
+
printf "\033[s" >&9
|
|
297
292
|
_draw
|
|
298
293
|
|
|
299
294
|
while true; do
|
|
@@ -314,13 +309,12 @@ _pick() {
|
|
|
314
309
|
j) _pick_move_down ;;
|
|
315
310
|
q|$'\003') stty "$_old" <&9 2>/dev/null; trap - EXIT INT TERM; exec 9>&-; exit 1 ;;
|
|
316
311
|
esac
|
|
317
|
-
printf "\033[
|
|
312
|
+
printf "\033[u\033[J" >&9
|
|
318
313
|
_draw
|
|
319
314
|
done
|
|
320
315
|
|
|
321
316
|
# collapse to just the selected line
|
|
322
|
-
printf "\033[
|
|
323
|
-
printf "\033[J" >&9
|
|
317
|
+
printf "\033[u\033[J" >&9
|
|
324
318
|
printf " ${ACCENT_BOLD}❯${RESET} ${BOLD}%s${RESET}\n" "${_items[$_cur]}" >&9
|
|
325
319
|
|
|
326
320
|
stty "$_old" <&9 2>/dev/null
|
|
@@ -335,7 +329,7 @@ _pick() {
|
|
|
335
329
|
_pick_fallback() {
|
|
336
330
|
local _var="$1" _prompt="$2"; shift 2
|
|
337
331
|
local -a _items=("$@") _i=1 _choice
|
|
338
|
-
printf "\n\033[1m%s\033[0m\n
|
|
332
|
+
printf "\n\033[1m%s\033[0m\n" "$_prompt" >/dev/tty
|
|
339
333
|
for _item in "${_items[@]}"; do
|
|
340
334
|
printf " %2d) %s\n" "$_i" "$_item" >/dev/tty
|
|
341
335
|
_i=$(( _i + 1 ))
|
|
@@ -677,7 +671,7 @@ lint_message() {
|
|
|
677
671
|
|
|
678
672
|
# report
|
|
679
673
|
local exit_code=0
|
|
680
|
-
printf "\n ${ACCENT_BOLD}lint${RESET} ${MUTED}%s${RESET}\n
|
|
674
|
+
printf "\n ${ACCENT_BOLD}lint${RESET} ${MUTED}%s${RESET}\n" "$header"
|
|
681
675
|
|
|
682
676
|
if [[ ${#errors[@]} -gt 0 ]]; then
|
|
683
677
|
for e in "${errors[@]}"; do
|
|
@@ -764,7 +758,7 @@ cmd_log() {
|
|
|
764
758
|
load_config
|
|
765
759
|
|
|
766
760
|
local limit="${1:-20}"
|
|
767
|
-
printf "\n ${ACCENT_BOLD}log${RESET} ${MUTED}last %s commits${RESET}\n
|
|
761
|
+
printf "\n ${ACCENT_BOLD}log${RESET} ${MUTED}last %s commits${RESET}\n" "$limit"
|
|
768
762
|
|
|
769
763
|
local _p_log_type='^([a-z][a-z0-9_-]*)[(:!]'
|
|
770
764
|
while IFS='|' read -r hash short_hash date author subject; do
|
|
@@ -798,7 +792,7 @@ cmd_log() {
|
|
|
798
792
|
# cmd: types
|
|
799
793
|
cmd_types() {
|
|
800
794
|
load_config
|
|
801
|
-
printf "\n ${ACCENT_BOLD}commit types${RESET}\n
|
|
795
|
+
printf "\n ${ACCENT_BOLD}commit types${RESET}\n"
|
|
802
796
|
for entry in "${TYPES[@]}"; do
|
|
803
797
|
local t e s d badge
|
|
804
798
|
IFS='|' read -r t e s d <<< "$entry"
|
|
@@ -831,7 +825,7 @@ cmd_init() {
|
|
|
831
825
|
cat > "${git_root}/${CC_CONFIG_FILE}" << JSONEOF
|
|
832
826
|
{
|
|
833
827
|
"\$schema": "${CC_SCHEMA_URL}",
|
|
834
|
-
"version": "
|
|
828
|
+
"version": "${CC_VERSION}",
|
|
835
829
|
"customTypes": [
|
|
836
830
|
{ "type": "wip", "emoji": "🚧", "semver": "none", "description": "Work in progress" }
|
|
837
831
|
],
|
|
@@ -983,13 +977,15 @@ ${BOLD}CONFIG${RESET} .cmt.json (JSON Schema → intellisense in VS Code / Jet
|
|
|
983
977
|
|
|
984
978
|
# dispatch
|
|
985
979
|
main() {
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
980
|
+
local cmd="${1:-commit}"
|
|
981
|
+
[[ $# -gt 0 ]] && shift
|
|
982
|
+
case "$cmd" in
|
|
983
|
+
commit|c) cmd_commit "$@" ;;
|
|
984
|
+
lint|l) cmd_lint "$@" ;;
|
|
985
|
+
init) cmd_init "$@" ;;
|
|
986
|
+
log) cmd_log "$@" ;;
|
|
987
|
+
types|t) cmd_types "$@" ;;
|
|
988
|
+
uninstall) cmd_uninstall "$@" ;;
|
|
993
989
|
version|-v|--version) cmd_version ;;
|
|
994
990
|
help|-h|--help|*) cmd_help ;;
|
|
995
991
|
esac
|
package/package.json
CHANGED
package/schema/cmt.schema.json
CHANGED
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
|
|
15
15
|
"version": {
|
|
16
16
|
"type": "string",
|
|
17
|
-
"description": "Config schema version. Currently '1.
|
|
17
|
+
"description": "Config schema version. Currently '1.1.2'.",
|
|
18
18
|
"pattern": "^\\d+\\.\\d+\\.\\d+$",
|
|
19
|
-
"default": "1.
|
|
20
|
-
"examples": ["1.
|
|
19
|
+
"default": "1.1.2",
|
|
20
|
+
"examples": ["1.1.2"]
|
|
21
21
|
},
|
|
22
22
|
|
|
23
23
|
"customTypes": {
|
|
@@ -124,7 +124,7 @@
|
|
|
124
124
|
"examples": [
|
|
125
125
|
{
|
|
126
126
|
"$schema": "https://raw.githubusercontent.com/mihai-ro/cmt/main/schema/cc.schema.json",
|
|
127
|
-
"version": "1.
|
|
127
|
+
"version": "1.1.2",
|
|
128
128
|
"customTypes": [
|
|
129
129
|
{
|
|
130
130
|
"type": "wip",
|