From 8aead83a357b30550b894c411a3c4cbea0f3a0f8 Mon Sep 17 00:00:00 2001
From: eliott <eliott.sammier@tetras-libre.fr>
Date: Fri, 5 Jul 2024 09:17:05 +0200
Subject: [PATCH] Fix CLI count-all for macao_3

---
 mcli                                                | 13 +++++++++----
 .../macao_3/result/indexes/count-all.txt            |  4 ++--
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/mcli b/mcli
index e7bd32cf..5e248c75 100755
--- a/mcli
+++ b/mcli
@@ -17,7 +17,7 @@ if [[ "$1" == "status" ]]; then
     exit
 fi
 
-export VERSION="${VERSION:-macao_12}" # macao_12 by default
+export VERSION="macao_${VERSION:-12}" # macao_12 by default
 export MACAO_ROOT="${MACAO_ROOT:-$(dirname "$(realpath "$0")")}"
 export SOURCES_DIR="$MACAO_ROOT/Basilisk/MACAO/$VERSION"
 export SCRIPTS_DIR="$MACAO_ROOT/tetras_extraction/$VERSION/script"
@@ -27,7 +27,7 @@ mkdir -p "$INDEXES_DIR"
 
 print_usage() {
     cat <<EOF
-Usage: $(basename "$0") <command> [args]
+Usage: $(basename "$0") [version] <command> [args]
 
 COMMANDS
 
@@ -131,8 +131,13 @@ count_all() {
         exit 1
     fi
 
-    nb_mod="$(grep -c '<item identifier="MosMod' "$SOURCES_DIR/imsmanifest.xml")"
-    nb_subs="$(grep -Ec 'MosEtp[0-9]+.html' "$index")"
+    if [[ "$VERSION" = "macao_3" ]]; then
+        nb_mod="$(grep -c '<item identifier="seq' "$SOURCES_DIR/imsmanifest.xml")"
+        nb_subs="$(grep -Ec 'act[0-9]+.html' "$index")"
+    else
+        nb_mod="$(grep -c '<item identifier="MosMod' "$SOURCES_DIR/imsmanifest.xml")"
+        nb_subs="$(grep -Ec 'MosEtp[0-9]+.html' "$index")"
+    fi
     nb_pages_all="$(grep -Ec '/contenu/.*\.htm' "$index")"
     nb_pages="$(grep -Ec '/contenu/pages/pg[0-9]+\.html$' "$index")"
     nb_pages_special="$((nb_pages_all - nb_pages))"
diff --git a/tetras_extraction/macao_3/result/indexes/count-all.txt b/tetras_extraction/macao_3/result/indexes/count-all.txt
index f8954d6d..96b61677 100644
--- a/tetras_extraction/macao_3/result/indexes/count-all.txt
+++ b/tetras_extraction/macao_3/result/indexes/count-all.txt
@@ -1,5 +1,5 @@
-modules:        0
-sous-parties:   0
+modules:        5
+sous-parties:   14
 pages:          97
     normales:       86
     spéciales:      11
-- 
GitLab