Repository: mesos Updated Branches: refs/heads/master 3c1a0bce1 -> 237a121c4 (forced update)
Improved documentation regarding the new CLI setup. Explains how to create the necessary virtual environment from anywhere and how to set up autocompletion in such case. Also removes an unnecessary activation of the virtual environment in `mesos` and `mesos-cli-tests`. Review: https://reviews.apache.org/r/65585/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/2f7f03f2 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/2f7f03f2 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/2f7f03f2 Branch: refs/heads/master Commit: 2f7f03f249a724d61265dabfadb5bb83eb2008e8 Parents: 99c73e0 Author: Armand Grillet <agril...@mesosphere.io> Authored: Thu Apr 12 14:37:10 2018 +0200 Committer: Kevin Klues <klue...@gmail.com> Committed: Thu Apr 12 14:43:34 2018 +0200 ---------------------------------------------------------------------- src/python/cli_new/README.md | 31 +++++++++++++++++++++++++++++-- src/python/cli_new/bootstrap | 27 +++++++++++++++++++++------ 2 files changed, 50 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/2f7f03f2/src/python/cli_new/README.md ---------------------------------------------------------------------- diff --git a/src/python/cli_new/README.md b/src/python/cli_new/README.md index 847141d..3d646e9 100644 --- a/src/python/cli_new/README.md +++ b/src/python/cli_new/README.md @@ -32,9 +32,36 @@ when you are done. $ source deactivate ``` -**NOTE:** The virtual environment will also setup bash -autocomplete for all `mesos` commands. +You can also run the `bootstrap` script from any directory +and specify the `VIRTUALENV_DIRECTORY` to set where it +should be created. +``` +$ VIRTUALENV_DIRECTORY=~/.mesos-cli-venv +$ ${MESOS_DIR}/src/python/cli_new/bootstrap + +... + +Setup complete! + +To begin working, simply activate your virtual environment, +run the CLI, and then deactivate the virtual environment +when you are done. + + $ source ~/.mesos-cli-venv/bin/activate + $ source ~/.mesos-cli-venv/bin/postactivate + $ mesos <command> [<args>...] + $ source ~/.mesos-cli-venv/bin/predeactivate + $ deactivate + + +The postactivate and predeactivate files set up autocompletion. +Add the mesos binary parent directory +${MESOS_DIR}/src/python/cli_new/bin/ +to your path, export it, and source +${MESOS_DIR}/src/python/cli_new/mesos.bash_completion +to skip these two steps in the future. +``` ## Running tests http://git-wip-us.apache.org/repos/asf/mesos/blob/2f7f03f2/src/python/cli_new/bootstrap ---------------------------------------------------------------------- diff --git a/src/python/cli_new/bootstrap b/src/python/cli_new/bootstrap index 9329a61..b30db50 100755 --- a/src/python/cli_new/bootstrap +++ b/src/python/cli_new/bootstrap @@ -94,16 +94,31 @@ PYTHONPATH="${OLD_PYTHONPATH}" complete -r mesos EOF +echo "" +echo "Setup complete!" +echo "" +echo "To begin working, simply activate your virtual" +echo "environment and deactivate it when you are done." +echo "" + if [ "${VIRTUALENV_DIRECTORY}" = "${CURRDIR}/.virtualenv" ]; then # Print some info about the sucess of the installation. - echo "" - echo "Setup complete!" - echo "" - echo "To begin working, simply activate your virtual" - echo "environment and deactivate it when you are done." - echo "" echo " $ source activate" echo " $ mesos <command> [<args>...]" echo " $ source deactivate" echo "" +else + echo " $ source ${VIRTUALENV_DIRECTORY}/bin/activate" + echo " $ source ${VIRTUALENV_DIRECTORY}/bin/postactivate" + echo " $ mesos <command> [<args>...]" + echo " $ source ${VIRTUALENV_DIRECTORY}/bin/predeactivate" + echo " $ deactivate" + echo "" + echo "The postactivate and predeactivate files set up autocompletion." + echo "Add the mesos binary parent directory" + echo "${CURRDIR}/bin/" + echo "to your path, export it, and source" + echo "${CURRDIR}/mesos.bash_completion" + echo "to skip these two steps in the future." + echo "" fi