netromdk / slacker

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

Workspace configuration #31

Closed netromdk closed 6 years ago

netromdk commented 6 years ago

Depends on #7 and #32.

Workspace configurations must be present in the config file, like workspace names and tokens.

Extend Config to expose predefined workspaces {name: token..}. But don't allow creating workspaces inside Slacker just yet to keep things secure. Nobody wants the tokens in a shell history!

Add --init argument to slacker that will create a default config file on disk and ask, on stdin, about workspace name and token, which will be saved to the config file. If a config file is already present it must ask whether the user wants to overwrite the file or stop.

If slacker is run without a config it should say that it doesn't have a config and slacker needs to be run with the --init argument.

Implement WorkspaceCommand with name "workspace" and alias "ws". It should have argument --set <workspace name>. If no arguments are given it should list the names of each known one but not the tokens! Like:

Predefined workspaces:
  0xCoders (active)
  luxionteam

Change the REPL to display the workplace so it's always evident, like workspace>

Examples:

% ./slacker.py
0xCoders> ws
Predefined workspaces:
  0xCoders (active)
  luxionteam
0xCoders> ws --set luxionteam
luxionteam> ws
Predefined workspaces:
  0xCoders
  luxionteam (active)

Let Config keep the active workspace that is also saved to the config file.

netromdk commented 6 years ago

@voidpirate, we also need a way to add more than one configuration without having to edit the config file manually. Don't you think so?

It's important that the token is not visible in history so we could add argument --create workspace_name that will then ask on stdin for the token, and we can even make it non-echoable. You know, like inputting *nix passwords in the shell.

That reminds me that --init should also use non-echoable input for the token!