From c904bb5b5f538f7b34d982ae45e6e1fd84cc3671 Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Sun, 29 Nov 2020 11:23:23 -0800 Subject: [PATCH] Update desktop readme, and add a helper script to use CLI args --- desktop/README.md | 14 ++++++++++++-- desktop/scripts/dev.sh | 9 +++++++++ desktop/scripts/rebuild-cli.sh | 1 + 3 files changed, 22 insertions(+), 2 deletions(-) create mode 100755 desktop/scripts/dev.sh diff --git a/desktop/README.md b/desktop/README.md index 053bf4ea..5e1c11ea 100644 --- a/desktop/README.md +++ b/desktop/README.md @@ -51,7 +51,7 @@ Download Tor Browser and extract the binaries: python scripts\get-tor-windows.py ``` -### Prepare the code +### Prepare the virtual environment OnionShare uses [Briefcase](https://briefcase.readthedocs.io/en/latest/). @@ -82,12 +82,22 @@ In order to work with the desktop app, you'll need to build a wheel of the CLI p ./scripts/rebuild-cli.sh ``` -Run OnionShare from the source tree like this: +### Running OnionShare from the source code tree + +Inside the virtual environment, run OnionShare like this to install all of the dependencies: ``` briefcase dev -d ``` +Once you have the dependencies installed, you can run it using the `dev.sh` script, which lets you use command line arguments, such as to `--verbose` or `--local-only`: + +``` +./scripts/dev.sh --help +./scripts/dev.sh -v +./scripts/dev.sh -v --local-only +``` + ## Running tests Install these packages inside your virtual environment: diff --git a/desktop/scripts/dev.sh b/desktop/scripts/dev.sh new file mode 100755 index 00000000..6ce5e796 --- /dev/null +++ b/desktop/scripts/dev.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +# Run OnionShare desktop, allowing you to use command-line arguments + +SCRIPTS_DIR="$( cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd )" +cd $SCRIPTS_DIR + +cd ../src +python -c "import onionshare; onionshare.main()" $@ \ No newline at end of file diff --git a/desktop/scripts/rebuild-cli.sh b/desktop/scripts/rebuild-cli.sh index f8191955..9d6a1338 100755 --- a/desktop/scripts/rebuild-cli.sh +++ b/desktop/scripts/rebuild-cli.sh @@ -5,5 +5,6 @@ SCRIPTS_DIR="$( cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd )" cd $SCRIPTS_DIR cd ../../cli +poetry install poetry build cp dist/*.whl ../desktop \ No newline at end of file