netromdk / slacker

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

Configurable prompt #76

Open netromdk opened 6 years ago

netromdk commented 6 years ago

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:

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.

0verbyte commented 5 years ago