diff options
author | Joris | 2023-09-17 12:23:47 +0200 |
---|---|---|
committer | Joris | 2023-09-17 12:23:47 +0200 |
commit | 1ebc55c72a1a17293bbf4ad86e0177a10a794750 (patch) | |
tree | 5fce0ea3a011ccbae85b0d3927f8ac33099585fb /cli/view/command.py | |
parent | c236facb4d4c277773c83f1a4ee85b48833d7e67 (diff) |
Make app packageable
Diffstat (limited to 'cli/view/command.py')
-rw-r--r-- | cli/view/command.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/cli/view/command.py b/cli/view/command.py new file mode 100644 index 0000000..72e44dd --- /dev/null +++ b/cli/view/command.py @@ -0,0 +1,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(' ')) |