Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add custom prompt text #159

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add custom prompt text #159

wants to merge 1 commit into from

Conversation

valkheim
Copy link

@valkheim valkheim commented Aug 9, 2019

New feature:

This allows the user to customize the prompt. url is parsed and formatted with the urlparse conventions.

Default configuration:

Default configuration is using the whole url (scheme, netloc, path, params, query, fragment):
prompt = '{scheme}{netloc}{path}{params}{query}{fragment}'

Example:

$ tail -n 1 ~/.config/http-prompt/config.py
prompt = '{netloc[1:]}{path[-2:]}'
$ http-prompt "http://www.example.org"
Version: 1.0.0
example.org/> cd foo/bar/baz
example.org/bar/baz>
Goodbye!

Possible updates:

  • Add spaces or other characters around elements: {path} will give /foo > from a /foo path
  • Chain the index operator: {path[-2:][1]} will give /f/b> from a moo/foo/bar path

I might be not good enough with python to ensure myself I didn't introduced a vulnerability through eval() in utils.get_prompt().

Related issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant