Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

[Feature Request] Add Workspace Context to Prompt #57

Open
decidedlygray opened this issue Nov 26, 2018 · 1 comment
Open

[Feature Request] Add Workspace Context to Prompt #57

decidedlygray opened this issue Nov 26, 2018 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@decidedlygray
Copy link

Since scan gets executed against your current workspace, it would be nice to have that context without having to execute ./celerystalk workspace.

I'm thinking something like how virtualenv lists your venv name in the command prompt. Any idea on how difficult this would be to implement?

I took a quick peek at how virtualenv is doing it when you run the activate script. It is just customizing the PS1 variable. Here is a little example script ps1_sandbox.sh I put together that activates a workspace context then deactivates it in case it helps:

#!/bin/bash

# execute using: source ps1_sandbox.sh

# check if this script has been run by testing of the _PS1_SAVED variable is populated
# and if it is populated, restore our original prompt. otherwise customize the prompt
if ! [ -z "${_PS1_SAVED}" ] ; then
    # this is like the virtualenv "deactivate" to restore original prompt
    echo "[+] Restoring the prompt..."
    PS1="$_PS1_SAVED"
    export PS1
    unset _PS1_SAVED
else
    # save off the original so we can restore it later
    echo "[+] Changing the prompt..."
    _PS1_SAVED=$PS1
    export _PS1_SAVED
    WORKSPACE_NAME=myworkspace
    PS1="($WORKSPACE_NAME) $PS1"
    export PS1
    TEST1="test"
    export TEST1
fi
@sethsec sethsec self-assigned this Dec 10, 2018
@sethsec sethsec added the enhancement New feature or request label Dec 10, 2018
@sethsec
Copy link
Owner

sethsec commented Dec 10, 2018

This is an awesome suggestion. I am planning in moving to an interactive REPL which will indeed tell you your current workspace. However, I do plan to keep the CLI version around as well, so this is definitely something i want to keep in the pipeline. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants