Nothing Special   »   [go: up one dir, main page]

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

Configurable prompt #76

Open
netromdk opened this issue Feb 9, 2018 · 1 comment
Open

Configurable prompt #76

netromdk opened this issue Feb 9, 2018 · 1 comment
Labels
Milestone

Comments

@netromdk
Copy link
Owner
netromdk commented Feb 9, 2018

The default WORKSPACE> prompt might not be to the liking of everybody, so we should define some custom language for specifying the prompt. It could be simply "%w> " with %w for the active workspace. And perhaps %ro for displaying read-only mode if in effect.

Per default it should use "%ro%w> " to be expanded into "workspace> " in normal mode and "(read-only) workspace> " in read-only mode.

Or we use {w} for workspace and {ro:read only string} so that the text can be user-defined including spaces etc. In this case the default would be "{ro:(read-only) }{w}> " instead.

Rename the config.repl_prefix to config.prompt. Later on we might add support for a right-prompt with config.right_prompt.

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/"

These are retrieved using auth.test and should be saved at startup for current auth info (saved in AuthInfo singleton or added to Config, perhaps even extend the saved workspaces with all this info simply so it isn't necessary to query all the time?) and then updated if another workspace is made active with workspace. The keep-it-in-the-config approach could look like the following:

{
  "workspaces": {
    "0xCoders": {
       "token": "TOKEN",
       "wid": "WORKSPACE_ID",
       "user": "USERNAME",
       "uid": "USER_ID",
       "url": "https://workspace.slack.com/",
    },
    ..
  },
  ..
}

A wiki page should be created to describe the language of the prompt.

@netromdk netromdk added this to the v0.3 milestone Feb 9, 2018
@netromdk netromdk modified the milestones: v0.3, v0.4 Feb 17, 2018
@0verbyte
Copy link
Collaborator
0verbyte commented Oct 28, 2018
  • POC using Python Template class from string library
  • Add wiki entry describing how the prompt template string works
  • Add support for other identifiers
    • Color
    • User
    • Workspace URL

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

No branches or pull requests

2 participants