netromdk / slacker

Slacker - Easy access to the Slack API and admin of workspaces/teams.
MIT License
14 stars 0 forks source link

Add configurable prompt #115

Closed 0verbyte closed 5 years ago

0verbyte commented 5 years ago

First pass at allowing the repl prompt to be configured using a template string. The prompt configuration is set in the config file with the default template string ${ro}${w}>.

Currently the prompt supports the following:

Additional entities could be added:

  • {u} for username, "username"
  • {uid} for user ID, "U8C3V3OQ"
  • {wid} for workspace ID, like "T9F3H7VLP"
  • {url} for workspace URL, like "https://workspace.slack.com/"

Other identifiers could easily be supported using this method, as discussed in #76.

This is a pretty trivial implementation as it doesn't have any lexical analysis, strictly a string replace. If we want to support more complex logic we'd have to subclass the Template class with our specific logic, or roll our own entirely.

0verbyte commented 5 years ago

Added comments.

Yeah I was going to write a wiki entry for this once we agreed on the template identifiers and general implementation.