Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maketiles: Config files like Makefiles #84

Closed
4 of 14 tasks
edemaine opened this issue Aug 15, 2022 · 1 comment
Closed
4 of 14 tasks

Maketiles: Config files like Makefiles #84

edemaine opened this issue Aug 15, 2022 · 1 comment

Comments

@edemaine
Copy link
Owner

edemaine commented Aug 15, 2022

The svgtiler CLI requires at least two arguments that are annoying to retype. The typical solution to this has been to write a Makefile and use that. But svgtiler really wants to be its own build system (so it can re-use Inkscape processes) so it makes more sense to define our own config file. We can still use the argument system, but store it in a file. For example:

--pdf --png  # export formats
( mapping1.coffee dir{1,2}/**/*.{asc,xlsx} )
( -s palette=castle mario.coffee -O door_castle door.tsv )
( -s palette=overworld mario.coffee -O door_overworld door.tsv )
( -s palette=overworld mario.coffee -o out -O *_overworld door.tsv )

Additional illustrated features that would make this particularly useful (many of which also make sense in CLI):

  • Parentheses to limit mapping files to specific drawings
  • -O to specify output base filename, not just directory. Perhaps just for the next drawing. (Currently want this in mario example.)
  • -O (and maybe not -o?) can use * (short for the stem of the input file) to specify basename stem modification in addition to directory. (Currently want this in mario example.)
  • -s/--share foo=bar argument to set share.foo = "bar"
  • Support for glob patterns including **
  • Comments via # (not for CLI)
  • Maketile (other names considered: svgtiler.config, svgtiler.opts, Tilefile) automatically loaded when running svgtiler
  • Options of (default rule of) Maketile automatically executed if no filename argument and no --help. This allows tweaking the options via e.g. svgtiler -f or svgtiler -w. But note that some options that look like filenames might be rule names, and should be interpreted as such instead.
  • Can manually specify a different *Maketile* or filename.tile (other extensions considered: .config/.opts) (or more than one) on command line
  • Specifying dir (or -r dir or -C dir like make or maybe [dir]?) or dir/Maketile on the command line recurses into dir directory and uses Maketile there. Probably also temporarily chdir there. This also means that you can specify directory names to recurse on in a Maketile.
  • We'll need shell-like quote and backslash parsing, to handle filenames with spaces or other special characters (e.g. *).
  • Should we allow specifying a minimum/maximum version number for svgtiler?
    For example, in NPM style: version: ^3.1.0
  • Could be nice to have a make clean equivalent of svgtiler --clean (or maybe svgtiler clean), which would delete all files that svgtiler would produce (.svg, .svg_tex if -t, .pdf if -p, .png if -P)
  • Rules to specify a subset of jobs to run via ruleName: [otherRule otherRule], like we can with Makefile. For example:
    all: icons proof1 proof2
    icons:
      -p -P map.coffee *.asc
    proof1:
      -p map.coffee proof1.xlsx
    proof2:
      -p map.coffee proof2.xlsx
    
    Then one could run svgtiler to run the first rule (here, all, which runs the three other rules), or svgtiler proof1 proof2 to run a subset of the rules.
@edemaine edemaine changed the title Config files Config files like Makefiles Sep 22, 2022
edemaine added a commit that referenced this issue Sep 23, 2022
A more flexible override for output stem (basename before extension).
Use of `*` implies that the `-O` setting remains intact,
whereas without the `*` it applies only to the next output.
edemaine added a commit that referenced this issue Sep 24, 2022
* `-s KEY` sets `share.KEY` to `undefined`
* `-s KEY=VALUE` sets `share.KEY` to `"VALUE"`
@edemaine edemaine changed the title Config files like Makefiles Maketiles: Config files like Makefiles Oct 1, 2022
This was referenced Oct 1, 2022
@edemaine
Copy link
Owner Author

edemaine commented Oct 5, 2022

Replaced by #99.

@edemaine edemaine closed this as completed Oct 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant