Skip to content

Commit

Permalink
Add comment support for the options file
Browse files Browse the repository at this point in the history
also changes its extension to .yaml
  • Loading branch information
azilvl committed Jan 26, 2020
1 parent c2e9ce8 commit e2129be
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 19 deletions.
39 changes: 28 additions & 11 deletions BuildMod.bat
Original file line number Diff line number Diff line change
@@ -1,17 +1,34 @@
@echo off
setlocal EnableDelayedExpansion
set "args="
if not exist options.txt (
echo includeExtraFiles=ask> OPTIONS.txt
echo rebuildMod=ask>> options.txt
echo combine=ask>> options.txt
echo copy=ask>> options.txt
echo updateMBINCompiler=ask>> options.txt
echo checkForConflicts=ask>> options.txt
echo recreatePakList=ask>> options.txt
echo|set /p="recreateMapFileTrees=ask">> options.txt
set "rootPath=%~dp0"
set "optionsFile=!rootPath!\OPTIONS.yaml"

if not exist %optionsFile% (
echo # These are the default options used by BuildMod.bat to build your mods.>%optionsFile%
echo # In each one of them you can either specify a default value or put 'ask'.>> %optionsFile%
echo # Any option with a value of ask will result in the builder to ask you the question during the build process.>> %optionsFile%
echo.>>%optionsFile%
echo # Possible Values:>> %optionsFile%
echo # combine = ask, none, simple, composite, numericSuffix>> %optionsFile%
echo # copy = ask, none, all, some>> %optionsFile%
echo.>>%optionsFile%
echo # All the other options are flags with possible values of: ask, true, false>> %optionsFile%
echo.>>%optionsFile%
echo combine: ask>> %optionsFile%
echo copy: ask>> %optionsFile%
echo includeExtraFiles: ask>> %optionsFile%
echo rebuildMod: ask>> %optionsFile%
echo updateMBINCompiler: ask>> %optionsFile%
echo checkForConflicts: ask>> %optionsFile%
echo recreatePakList: ask>> %optionsFile%
echo|set /p="recreateMapFileTrees: ask">> %optionsFile%
)
for /f "tokens=1,2 delims==" %%G in (options.txt) do (

rem The added space character in `delims=: ` is to support same line comments in the yaml file.
rem As a side effect typing `key value` instead of `key: value` would also work.
rem If we decide to just not support same line comments we should change it to `delims=:`
for /f "tokens=1,2 eol=# delims=: " %%G in (%optionsFile%) do (
set "args=!args!-%%G %%~H "
)
Builder.bat %args%
!rootPath!\Builder.bat %args%
8 changes: 0 additions & 8 deletions OPTIONS.txt

This file was deleted.

18 changes: 18 additions & 0 deletions OPTIONS.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# These are the default options used by BuildMod.bat to build your mods.
# In each one of them you can either specify a default value or put 'ask'.
# Any option with a value of ask will result in the builder to ask you the question during the build process.

# Possible Values:
# combine = ask, none, simple, composite, numericSuffix
# copy = ask, none, all, some

# All the other options are flags with possible values of: ask, true, false

combine: ask
copy: ask
includeExtraFiles: ask
rebuildMod: ask
updateMBINCompiler: ask
checkForConflicts: ask
recreatePakList: ask
recreateMapFileTrees: ask

1 comment on commit e2129be

@HolterPhylo
Copy link
Collaborator

@HolterPhylo HolterPhylo commented on e2129be Jan 26, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great. Just what I was looking for. And I see your English is surely as good as mine (French-Canadian here)

Please sign in to comment.