diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..8291fa7 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,21 @@ +name: Publish + +on: + release: + types: + - released + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - name: Git checkout + uses: actions/checkout@v1 + - name: Node 14.6 + uses: actions/setup-node@v1 + with: + node-version: 14.6 + - name: Publish + uses: JS-DevTools/npm-publish@v1 + with: + token: ${{ secrets.NPM_TOKEN }} diff --git a/.gitignore b/.gitignore index f04e953..43f2815 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,75 @@ /build /src/.slack +### JetBrains template +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..73f69e0 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..7a98b19 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/slack-cli.iml b/.idea/slack-cli.iml new file mode 100644 index 0000000..c956989 --- /dev/null +++ b/.idea/slack-cli.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..aee3e1a --- /dev/null +++ b/package-lock.json @@ -0,0 +1,5 @@ +{ + "name": "slack-cli", + "version": "0.0.1", + "lockfileVersion": 1 +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..fa055e2 --- /dev/null +++ b/package.json @@ -0,0 +1,31 @@ +{ + "name": "slack-cli", + "version": "0.0.1", + "description": "A fork from rockymadden/slack-cli", + "bin": { + "slack-cli": "src/slack" + }, + "directories": { + "test": "test" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/lenneTech/slack-cli.git" + }, + "keywords": [ + "slack", + "cli", + "tool", + "awesome" + ], + "author": "Pascal Klesse", + "license": "ISC", + "bugs": { + "url": "https://github.com/lenneTech/slack-cli/issues" + }, + "homepage": "https://github.com/lenneTech/slack-cli#readme", + "dependencies": {} +} diff --git a/src/slack b/src/slack index e309d95..20b8137 100755 --- a/src/slack +++ b/src/slack @@ -23,7 +23,7 @@ case "${cmd}${1}" in presenceactive|presenceaway|\ reminderadd|remindercomplete|reminderdelete|reminderinfo|reminderlist| \ snoozeend|snoozeinfo|snoozestart|\ - statusclear|statusedit) + statusclear|statusedit|statusget) sub=${1} ; shift ;; esac @@ -410,6 +410,9 @@ function help() { echo " ${bin} status edit [ []]" echo ' [--compact|-c] [--filter|-f ] [--monochrome|-m] [--trace|-x]' echo + echo " ${bin} status get" + echo ' [--compact|-c] [--filter|-f ] [--monochrome|-m] [--trace|-x]' + echo echo 'Configuration Commands:' echo ' init Initialize' echo @@ -443,9 +446,10 @@ function help() { echo 'Status Commands:' echo ' status clear Clear status' echo ' status edit Edit status' + echo ' status get Get status' echo echo 'More Information:' - echo ' repo https://github.com/rockymadden/slack-cli' + echo ' repo https://github.com/lenneTech/slack-cli' } function filedelete() { @@ -655,8 +659,16 @@ function statusedit() { jqify "${msg}" } +function statusget() { + local msg=$(\ + curl -s https://slack.com/api/users.profile.get \ + --data-urlencode "token=${token}") + + jqify "${msg}" +} + function version() { - echo '0.18.0' + echo '0.0.1' } # COMMAND ROUTING ################################################################################# @@ -669,7 +681,7 @@ case "${cmd}${sub}" in presenceactive|presenceaway|\ reminderadd|remindercomplete|reminderdelete|reminderinfo|reminderlist|\ snoozeend|snoozeinfo|snoozestart|\ - statusclear|statusedit) + statusclear|statusedit|statusget) if [ -z "${token}" ]; then echo '{"ok": false, "error": "not_inited"}' | jq -r ${compact} ${monochrome} "${filter:=.}" ; exit 1