这是indexloc提供的服务,不要输入任何密码
Skip to content

Q: is there a proto deactivate equivalent #803

@RobertVillalba

Description

@RobertVillalba

Hello, I was wondering if there is a proto deactivate equivalent for users that choose to go down the proto activate route. This is how I remember doing similar things in python environments so I'm not sure if I'm possibly missing something here. Looking for some quick options in bash I could likely undo the activation for bash via something like.

# Restore original PATH if it was saved
if [ -n "$__ORIG_PATH" ]; then
  export PATH="$__ORIG_PATH"
  unset __ORIG_PATH
fi

# Remove _proto_activate_hook from PROMPT_COMMAND
if [[ "$(declare -p PROMPT_COMMAND 2>&1)" == "declare -a"* ]]; then
  # PROMPT_COMMAND is an array
  PROMPT_COMMAND=("${PROMPT_COMMAND[@]//_proto_activate_hook/}")
else
  # PROMPT_COMMAND is a string
  PROMPT_COMMAND="${PROMPT_COMMAND//_proto_activate_hook;}"
  PROMPT_COMMAND="${PROMPT_COMMAND//_proto_activate_hook/}"
fi

# Unset the proto hook function
unset -f _proto_activate_hook 2>/dev/null

I just worry about something like this breaking with later versions of proto if it is not internaly supported

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions