diff --git a/mcli b/mcli
index c9d2fde2822729492a86639f225a96fdf2690fd3..bd32c4c6a152821caa5120cb9e5e758d239434c7 100755
--- a/mcli
+++ b/mcli
@@ -2,17 +2,23 @@
 
 # Default value for version env var
 if [[ -z "$VERSION" ]]; then
-    VERSION="each"
+    VERSION="macao_12"
 fi
 # First parameter overrides version if set
+version_regex='^(macao_12|macao_3|each|full)$'
 if [[ "$1" == "12" || "$1" == "3" ]]; then
     VERSION="macao_$1"
     shift
-elif [[ "$1" = "each" || "$1" = "full" ]]; then
+elif [[ "$1" =~ $version_regex ]]; then
     VERSION="$1"
     shift
 fi
 export VERSION
+if [[ ! "$VERSION" =~ $version_regex ]]; then
+    echo "Invalid version '$VERSION'"
+    exit 1
+fi
+
 # Special version value "each" is processed by calling the script itself once
 # for each actual version
 if [[ "$VERSION" = "each" && "$1" != "shell" && "$1" != "status" && "$1" != "setup" ]]; then
@@ -35,40 +41,47 @@ print_usage() {
     cat <<EOF
 Usage: $(basename "$0") [version] <command> [args]
 
-COMMANDS
+VERSION
+    Specifies which part of the MACAO repository to use: "macao_12", "macao_3"
+    (or simply "12" and "3"), "each" for both in separate result dirs
+    and "full" for both merged in a single result dir.
+    If not specified, uses the value of the "VERSION" environment variable,
+    or "12" by default. Some commands do not support every version.
 
-status
-    Print useful info about the current environment.
-shell [-p|--pyenv]
-    Open a shell with mcli's environment variables set, including PATH.
-    If -p or --pyenv is specified, also enter the Python virtual env.
-list-streams <file>
-    List audio streams in <file>
-count-streams [<file>]
-    Count audio streams in <file>, or from all SWF files if none is given
-index-extensions
-    Index all files by extension
-count-all [-f|--force]
-    Count many types of Macao objects.
-    If -f or --force is given, refresh indexes before counting (equivalent to count-streams and index-extensions)
-setup
-    Initialize Python environment required by extractors
-setup-debug
-    (Re)create .env file used by the Python debugger launch config
-extract
-    Run the extract stage, to generate RDF from text sources
-transform
-    Run the transform stage, to complete and clean-up the RDF data
-export
-    Run the export stage, to generate Macao-Hugo content pages
-convert
-    Run the full conversion process (extract -> transform -> export)
-test
-    Run simple tests on the extracted RDF data
-extract-mp3 [-y|--yes-overwrite]
-    Extract audio streams from all Flash SWF files
-help
-    Print this help and exit
+COMMANDS
+    status
+        Print useful info about the current environment.
+    shell [-p|--pyenv]
+        Open a shell with mcli's environment variables set, including PATH.
+        If -p or --pyenv is specified, also enter the Python virtual env.
+    list-streams <file>
+        List audio streams in <file>
+    count-streams [<file>]
+        Count audio streams in <file>, or from all SWF files if none is given
+    index-extensions
+        Index all files by extension
+    count-all [-f|--force]
+        Count many types of Macao objects.
+        If -f or --force is given, refresh indexes before counting (equivalent
+        to count-streams and index-extensions)
+    setup
+        Initialize Python environment required by extractors
+    setup-debug
+        (Re)create .env file used by the Python debugger launch config
+    extract
+        Run the extract stage, to generate RDF from text sources
+    transform
+        Run the transform stage, to complete and clean-up the RDF data
+    export
+        Run the export stage, to generate Macao-Hugo content pages
+    convert
+        Run the full conversion process (extract -> transform -> export)
+    test
+        Run simple tests on the extracted RDF data
+    extract-mp3 [-y|--yes-overwrite]
+        Extract audio streams from all Flash SWF files
+    help
+        Print this help and exit
 EOF
 }
 
@@ -131,6 +144,7 @@ index_extensions() {
     allfiles="$(find . -path '**/.idea' -prune -o -type f -print)"
     cd - || exit
     # List all extensions, then for each one, filter the index for files with this extension
+    # ( Perl expression courtesy of https://stackoverflow.com/a/1842270 )
     perl -ne 'print $1 if m/\.([^.\/]+)$/**//' <<<"$allfiles" | sort -u | while read -r ext; do
         echo "[$ext]" >>"$out_file"
         grep -E ".*\.$ext\$" <<<"$allfiles" | sort >>"$out_file"