Sfoglia il codice sorgente

Updating language_chooser.sh

Vinicius Teshima 1 mese fa
parent
commit
48df45d0c5
1 ha cambiato i file con 20 aggiunte e 10 eliminazioni
  1. 20 10
      language_chooser.sh

+ 20 - 10
language_chooser.sh

@@ -1,13 +1,23 @@
 #!/bin/sh
 
 
-languages="C++
-Python
-TypeScript
-C
-Go
-Ruby
-PHP
-Racket"
-
-echo "$languages" | shuf | head -n5
+#languages="C++
+#Python
+#TypeScript
+#C
+#Go
+#Ruby
+#PHP
+#Racket"
+#
+#echo "$languages" | shuf | head -n5
+
+lang_frek="$(find . -maxdepth 1 -mindepth 1 -not -path './.git' -type d \
+    | parallel -j1 'find {} -maxdepth 1 -mindepth 1 -type f | wc -l | xargs echo {}' \
+    | sort -k2)"
+
+lest_amount="$(echo "$lang_frek" | head -n1 | cut -d' ' -f2)"
+
+possibles="$(echo "$lang_frek" | grep "$lest_amount" | sed "s/ ${lest_amount}//g")"
+
+echo "$possibles" | shuf | head -n5