herrjulz / aviator

Merge YAML/JSON files in a in a convenient fashion based on a configuration file called aviator.yml
MIT License
60 stars 7 forks source link

Generic file manipulations #19

Closed prein closed 5 years ago

prein commented 6 years ago

I am managing yaml configs with spruce / aviator but also there are some non-yaml static config files that I am copying along. I imagine this applies to some other peoples workflows as well. It would help greatly if I could do things like copy a list of files from place to place. Something like for_each with its properties combined with to_dir but without spruce merge.

herrjulz commented 6 years ago

Hi @prein, thx for opening an issue.

I thought about something like that as well. For example something like:

exec: cp
for_each_in: folder/
to: destination/

or

exec: rm
for:
- folder/file1
- folder/file2

exec in that case could be any file manipulation linux cmd like: cp, mv, rm, chmod, etc.

Is that what you think of?

prein commented 6 years ago

Hi @JulzDiverse

Thanks for taking the time to think about it. I like the exec approach. Would that support multiple exec calls?

On a minor note: Looking at the example you provided I had an idea for different nesting, although my idea won't be that consistent with how spruce is called. Anyway, let me share my thoughts. I mean doing this for example:

exec:
  cp:
    for_each_in: folder/
    to: destination/
  rm:
    for:
    - folder/file1
    - folder/file2

instead of

exec: cp:
  for_each_in: folder/
  to: destination/
exec: rm:
  for:
  - folder/file1
  - folder/file2
herrjulz commented 5 years ago

Hi @prein, I thought a long time about this feature. But I wasn't sure if I really want to add it. Aviator is a tool that should really serve YAML files only. So it was kinda hard to find a good way to integrate such a feature. However, I worked on a "generic" executor, which I think fits good for such use cases. You can define an arbitrary number of generic executors that can execute any installed command/executable. It will be part of the next aviator release (v1.5.0).

herrjulz commented 5 years ago

Hey @prein, the new release is now available: https://github.com/JulzDiverse/aviator/releases/tag/v1.5.0