-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add script for courses (print lessons names)
- Loading branch information
Showing
2 changed files
with
17 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
|
||
# Находим все файлы spec.yml в поддиректориях | ||
files=$(find * -mindepth 1 -maxdepth 1 -type f -name 'spec.yml') | ||
|
||
# Парсим значение ключа .lesson.name из каждого файла используя утилиту yq | ||
for file in $files; do | ||
lesson_name=$(yq '.lesson.name' $file) | ||
directory=$(dirname $file) | ||
# NOTE: выводим \t как есть, чтобы потом его заменить как есть. в 99% случаев вывод копируется в эксель, но bash выводит не таб-символ, а пробелы. Может это чисто моя проблема. | ||
echo "$directory\t$lesson_name" | ||
done | sort -t '/' -k 2 |