help="Host port to serve your content on") @click.option("-z", "--archive", type=click.Path(), required=True, default=envvar('SEV_ARCHIVE', ''), help="Path to your Slack export archive (.zip file or directory)" ) @click.option('-I', '--ip', default=envvar('SEV_IP', 'localhost'), type=click.STRING, help="Host IP to serve your content on") @click.option('--no-browser', is_flag=True, default=flag_ennvar("SEV_NO_BROWSER"), help="If you do not want a browser to open " "automatically, set this.") @click.option('--channels', type=click.STRING, default=envvar("SEV_CHANNELS", None), help="A comma separated list of channels to parse.") @click.option('--no-sidebar', is_flag=True, default=flag_ennvar("SEV_NO_SIDEBAR"), help="Removes the sidebar.") @click.option('--no-external-references', is_flag=True, default=flag_ennvar("SEV_NO_EXTERNAL_REFERENCES"), help="Removes all references to external css/js/images.") @click.option(
import os from slackviewer.constants import SLACKVIEWER_TEMP_PATH from slackviewer.utils.click import envvar, flag_ennvar @click.group() def cli(): pass @cli.command( help= "Cleans up any temporary files (including cached output by slack-export-viewer)" ) @click.option("--wet", "-w", is_flag=True, default=flag_ennvar("SEV_CLEAN_WET"), help="Actually performs file deletion") def clean(wet): if wet: if os.path.exists(SLACKVIEWER_TEMP_PATH): print("Removing {}...".format(SLACKVIEWER_TEMP_PATH)) shutil.rmtree(SLACKVIEWER_TEMP_PATH) else: print("Nothing to remove! {} does not exist.".format( SLACKVIEWER_TEMP_PATH)) else: print("Run with -w to remove {}".format(SLACKVIEWER_TEMP_PATH))
help="Host port to serve your content on") @click.option("-z", "--archive", type=click.Path(), required=True, default=envvar('SEV_ARCHIVE', ''), help="Path to your Slack export archive (.zip file or directory)" ) @click.option('-I', '--ip', default=envvar('SEV_IP', 'localhost'), type=click.STRING, help="Host IP to serve your content on") @click.option('--no-browser', is_flag=True, default=flag_ennvar("SEV_NO_BROWSER"), help="If you do not want a browser to open " "automatically, set this.") @click.option( '--test', is_flag=True, default=flag_ennvar("SEV_TEST"), help= "Runs in 'test' mode, i.e., this will do an archive extract, but will not start the server," " and immediately quit.") @click.option('--debug', is_flag=True, default=flag_ennvar("FLASK_DEBUG")) def main(port, archive, ip, no_browser, test, debug): if not archive: raise ValueError("Empty path provided for archive") configure_app(app, archive, debug)
from slackviewer.constants import SLACKVIEWER_TEMP_PATH from slackviewer.utils.click import envvar, flag_ennvar from slackviewer.reader import Reader from slackviewer.archive import get_export_info from jinja2 import Environment, PackageLoader @click.group() def cli(): pass @cli.command(help="Cleans up any temporary files (including cached output by slack-export-viewer)") @click.option("--wet", "-w", is_flag=True, default=flag_ennvar("SEV_CLEAN_WET"), help="Actually performs file deletion") def clean(wet): if wet: if os.path.exists(SLACKVIEWER_TEMP_PATH): print("Removing {}...".format(SLACKVIEWER_TEMP_PATH)) shutil.rmtree(SLACKVIEWER_TEMP_PATH) else: print("Nothing to remove! {} does not exist.".format(SLACKVIEWER_TEMP_PATH)) else: print("Run with -w to remove {}".format(SLACKVIEWER_TEMP_PATH)) @cli.command(help="Generates a single-file printable export for an archive file or directory") @click.argument('archive_dir') def export(archive_dir):
top.dms = reader.compile_dm_messages() top.dm_users = reader.compile_dm_users() top.mpims = reader.compile_mpim_messages() top.mpim_users = reader.compile_mpim_users() @click.command() @click.option('-p', '--port', default=envvar('SEV_PORT', '5000'), type=click.INT, help="Host port to serve your content on") @click.option("-z", "--archive", type=click.Path(), required=True, default=envvar('SEV_ARCHIVE', ''), help="Path to your Slack export archive (.zip file or directory)") @click.option('-I', '--ip', default=envvar('SEV_IP', 'localhost'), type=click.STRING, help="Host IP to serve your content on") @click.option('--no-browser', is_flag=True, default=flag_ennvar("SEV_NO_BROWSER"), help="If you do not want a browser to open " "automatically, set this.") @click.option('--channels', type=click.STRING, default=envvar("SEV_CHANNELS", None), help="A comma separated list of channels to parse.") @click.option('--no-sidebar', is_flag=True, default=flag_ennvar("SEV_NO_SIDEBAR"), help="Removes the sidebar.") @click.option('--no-external-references', is_flag=True, default=flag_ennvar("SEV_NO_EXTERNAL_REFERENCES"), help="Removes all references to external css/js/images.") @click.option('--test', is_flag=True, default=flag_ennvar("SEV_TEST"), help="Runs in 'test' mode, i.e., this will do an archive extract, but will not start the server," " and immediately quit.") @click.option('--debug', is_flag=True, default=flag_ennvar("FLASK_DEBUG"))