cli client for mastodon social media platform
💡 gnu/linux
and macOs
are machines on which we work on. while it is
possible to work over Windows
, our helpful documentation and scripts won't be
available to you...
since we don't provide pre-built binaries, having Go installed on your machine is required. Follow this link: https://go.dev/dl/
-
Clone repo to your local machine (fork repo if you intend to be a Contributor!)
git clone https://github.com/socraticDevBlog/mastodonctl.git
-
setup golang common configurations in your
.bashrc
, or.zshrc
, or else configuration file:
# make Golang binary available from your PATH
export PATH=$PATH:/usr/local/go/bin
# set your GOPATH (if 'go' directory doesn't exist, create it beforehand)
export GOPATH=$HOME/go
# make mastodonctl executable binary available from your PATH
export PATH=$PATH:${GOPATH}/bin/mastodonctl
- Run setup script:
source ./setup.sh
mastodonctl
is now available as CLI tool! 🚀
As an experienced user, you may want to customize your commandline-tool.
This is possible by editing conf.json
file
field | description |
---|---|
ResultsDisplayCount | number of results displayed in your terminal |
ApiUrl | URL of targetted mastodon server |
AuthToken | auth token required to interact with a server's API |
query Mastodon server's API for a specific hashtag
mastodonctl hashtag duck
* requires auth token for the server used
Will query Mastodon server's API for user infos based on their username
populate AuthToken
field in conf.json configuration file
conf.json
file to git
version control
try out a few commands to see if everything is working properly
go run . accounts dave
Expect:
Will query Mastadon server's public API for latest post tagged with a specific hashtag
go run . hashtag cat
Expect:
- my
.profile
file
# golang configs
export GOPATH=$HOME/go
export PATH="$GOPATH/bin:$PATH"
# mastodonctl
# a valid conf.json file located beside mastodonctl binary
export MASTODONCTL_CONFIG_FILEPATH="$GOPATH/bin/conf.json"
if you don't have Golang set up on your machine or don't want to modify it, you can try out mastodonctl using Docker!
build the image locally
docker build -t mastodonctl:latest .
docker run mastodonctl:latest
if you already have a valid Mastodonc API token, you can run any mastodonctl
available commands
docker run --env AUTH_TOKEN=<replace with your Mastodon API token> mastodonctl:latest accounts gargron