12345678910111213141516171819202122232425262728293031323334353637383940 |
- #!/usr/bin/fish
- set SLIDE_NUM $argv[1]
- set SLIDE_NAME $argv[2]
- set SLIDE_TITLE $argv[3]
- set SLIDE_NAME_MARK 'TEMPLATE_NAME'
- set SLIDE_TITLE_MARK 'TEMPLATE_TITLE'
- set SLIDES_PATH "../godot/slides"
- set TEMPLATE_FOLDER "$SLIDES_PATH/template"
- set TEMPLATE_FILE "$TEMPLATE_FOLDER/$SLIDE_NAME_MARK.tscn"
- set SLIDE_FOLDER "$SLIDES_PATH/$SLIDE_NUM"
- set SLIDE_FILE "$SLIDE_FOLDER/$SLIDE_NAME"
- function gen-res-id
- echo (head -n 10 /dev/urandom | tr -dc 'a-z' | string shorten -m 5 --char="")
- end
- set IDS (gen-res-id) (gen-res-id) (gen-res-id)
- set IDS_MARK 'aaaaa' 'bbbbb' 'ccccc'
- echo "Read $TEMPLATE_FILE"
- set CONTENT (cat $TEMPLATE_FILE)
- function get-content
- printf %s\n $CONTENT
- end
- echo "Rename template : $SLIDE_NAME_MARK -> $SLIDE_NAME"
- set CONTENT (get-content | sed -e "s/$SLIDE_NAME_MARK/$SLIDE_NAME/")
- echo "Set title : $SLIDE_TITLE_MARK -> $SLIDE_TITLE"
- echo "Replace marks"
- for k in (seq 3)
- echo $k ':' $IDS_MARK[$k] '->' $IDS[$k]
- end
- echo "Write to : $SLIDE_FILE"
- get-content
|