Skip to content

socraticDevBlog/mastodonctl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

77 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mastodonctl logo

mastodonctl

cli client for mastodon social media platform

installation

💡 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/

  1. Clone repo to your local machine (fork repo if you intend to be a Contributor!)

    git clone https://github.com/socraticDevBlog/mastodonctl.git
  2. 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
  1. Run setup script:
    source ./setup.sh

mastodonctl is now available as CLI tool! 🚀

configurations

As an experienced user, you may want to customize your commandline-tool.

This is possible by editing conf.json file

configurable values

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

current available commands

hashtag

query Mastodon server's API for a specific hashtag

mastodonctl hashtag duck

userinfos

* requires auth token for the server used

Will query Mastodon server's API for user infos based on their username

suggested way to store private credentials

populate AuthToken field in conf.json configuration file

⚠️ never commit conf.json file to git version control

start working on local machine

try out a few commands to see if everything is working properly

list users by username

go run . accounts dave

Expect:

ctl results for userinfos

hashtag

Will query Mastadon server's public API for latest post tagged with a specific hashtag

go run . hashtag cat

Expect:

ctl results for cat

freely available Mastodon apps

my local Golang setup

  • 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"

Docker containerize your CLI

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

About

cli client for mastodon social media platform

Resources

Stars

Watchers

Forks

Packages

No packages published