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

Provide a user list command #54

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ Usage:
slack status edit [<text> [<emoji>]]
[--compact|-c] [--filter|-f <filter>] [--monochrome|-m] [--trace|-x]

slack user list

Configuration Commands:
init Initialize

Expand Down
10 changes: 8 additions & 2 deletions src/slack
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ case "${cmd}${1}" in
filedelete|fileinfo|filelist|fileupload|\
presenceactive|presenceaway|\
snoozeend|snoozeinfo|snoozestart|\
statusedit)
statusedit|userlist)
sub=${1} ; shift
;;
esac
Expand Down Expand Up @@ -524,6 +524,12 @@ function statusedit() {
jqify "${msg}"
}

userlist() {
local msg=$(\
curl -s -X POST https://slack.com/api/users.list --data-urlencode "token=${token}")
jqify "${msg}"
}

function version() {
echo 'v0.14.0'
}
Expand All @@ -537,7 +543,7 @@ case "${cmd}${sub}" in
filedelete|fileinfo|filelist|fileupload|\
presenceactive|presenceaway|\
snoozeend|snoozeinfo|snoozestart|\
statusedit)
statusedit|userlist)
if [ -z "${token}" ]; then
echo '{"ok": false, "error": "not_inited"}' |
jq -r ${compact} ${monochrome} "${filter:=.}" ; exit 1
Expand Down