bkanber / Slackadaisical

Command line Slack chat client.
GNU General Public License v3.0
277 stars 14 forks source link

Add support for multiple workspaces #11

Open j6k4m8 opened 6 years ago

j6k4m8 commented 6 years ago

Invoke with slackadaisical myWorkspace, with a JSON file at ~/.slack_token shaped like this:

{
    "myWorkspace":        "xxx-slack-token-...",
    "myOtherWorkspace":   "xxx-slack-token-...",
}

Addresses #10 and (part of) #6.

Input and feedback very welcome!

j6k4m8 commented 6 years ago

Just added some more inline documentation.

Etenil commented 6 years ago

@j6k4m8 Could we move that file do perhaps ~/.slackadaisicalrc or ~/.slackadaisical.json as it doesn't only contain a token anymore. And I'd like to use it to add other configuration options.

j6k4m8 commented 6 years ago

I was thinking the same thing. Maybe something like this?

{
    "workspaces": {
        "workspace-name": {
            "token": "...",
            // Room for other options
        },
    // Room for other workspaces
    },
    // Room for global options
}
j6k4m8 commented 6 years ago

(It also makes sense for #12 to merge first, since it adds command-line-args which I'll use here instead of my process.argv code)

Etenil commented 6 years ago

@j6k4m8 Yes the structure for the proposed config file is perfect from my point of view.

j6k4m8 commented 6 years ago

Now uses the JSON format specified in the comment (not the original PR description).

If you fail to specify a workspace:

$ slackadaisical 
If using multi-workspace mode, you must specify a workspace with `slackadaisical [workspacename]`.

If you misspell or ask for a workspace that DNE:

$ slackadaisical badconversations
Couldn't find workspace [badconversations] in ~/.slackadaisical.json. Your options are:
* goodconversations
* justgifs
$ slackadaisical goodconversations

works as expected.

$ slackadaisical

with a ~/.slack_token file still works. (We can optionally remove this if you choose to deprecate that method of auth.)

j6k4m8 commented 6 years ago

@bkanber hoping to get your thoughts / merge on this? :)

bkanber commented 6 years ago

Of course! I'm out of town this week and wrapping up a book next week but I will certainly hop on this, I haven't forgotten you guys!

On Mon, Apr 23, 2018, 7:34 PM Jordan Matelsky notifications@github.com wrote:

@bkanber https://github.com/bkanber hoping to get your thoughts / merge on this? :)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bkanber/Slackadaisical/pull/11#issuecomment-383755255, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEdNhox4ykI1oIKdMEVLyIV4Azxw8Mlks5trmTqgaJpZM4SQAM6 .

j6k4m8 commented 6 years ago

May I poke again on this? :)