blob: 72e44ddc5022851f3926b5260eaf260d6c11350a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
import cli.library.command
import shutil
import subprocess
import subprocess
import tempfile
import time
def run(books_library, books_browser, bin_dir):
tmp_dir = tempfile.mkdtemp()
shutil.copytree(f'{bin_dir}/library/public', tmp_dir, dirs_exist_ok=True)
subprocess.run(['chmod', 'u+w', tmp_dir])
with open(f'{tmp_dir}/books.js', 'w') as f:
json = cli.library.command.get(books_library)
f.write(f'const bookLibrary = {json}')
browser_cmd = f'{books_browser} {tmp_dir}/index.html'
subprocess.run(browser_cmd.split(' '))
|