| 1 | import os |
| 2 | import cli |
| 3 | import net.urllib |
| 4 | |
| 5 | pub fn sync() cli.Command { |
| 6 | return cli.Command{ |
| 7 | name: 'sync' |
| 8 | description: 'sync local dens from remote' |
| 9 | execute: execsync |
| 10 | } |
| 11 | } |
| 12 | |
| 13 | fn execsync(cmd cli.Command) ! { |
| 14 | dens := os.read_lines('/etc/fox/dens')!.map(urllib.parse(it)!) |
| 15 | mut threads := []thread !{} |
| 16 | for den in dens { |
| 17 | threads << spawn update(den) |
| 18 | } |
| 19 | threads.map(it.wait()!) |
| 20 | } |
| 21 | |
| 22 | fn update(den urllib.URL) ! { |
| 23 | println(den.str()) |
| 24 | return |
| 25 | } |
| 26 |