A simple command-line tool to post tweets written in Zig.
On first run, the tool will ask for your Twitter API credentials. You'll need all 4 values from your app's "Keys and tokens" page:
- API Key and API Secret (under "Consumer Keys")
- Access Token and Access Token Secret (under "Authentication Tokens")
If you don't have Access Tokens yet:
- Click "Generate" next to "Access Token and Secret"
- Make sure they have "Read and Write" permissions
- Copy all 4 values when prompted
The credentials will be saved to ~/.config/tweet/config
Build the tool:
zig build -Doptimize=ReleaseFastInstall to your PATH:
cp zig-out/bin/tweet ~/.local/bin/
# or
sudo cp zig-out/bin/tweet /usr/local/bin/Tweet from command line (returns the tweet URL):
tweet "Hello, world!"
# Output: https://twitter.com/i/status/1234567890Tweet with image or video:
tweet "Check this out!" --attach ~/Desktop/screenshot.png
tweet "New video!" --attach video.mp4Pipe text to tweet:
echo "Hello from pipe!" | tweetPipe text with media:
echo "Great photo!" | tweet --attach photo.jpgPipe file path for media (use - for stdin):
echo "~/Desktop/latest.png" | tweet "Screenshot:" --attach -
find ~/Pictures -name "*.jpg" | head -1 | tweet "Photo of the day" --attach -- Images: JPG, PNG, GIF, WebP (max 5MB)
- Videos: MP4, MOV, AVI, WebM (max 512MB)
If media attachments aren't working, use the --debug flag to see detailed output:
tweet "Test with image" --attach photo.jpg --debugThe tool uses OAuth 1.0a to authenticate with Twitter's API:
- On first run, it asks for all 4 credentials from your Twitter app
- Stores them securely in
~/.config/tweet/config - Uses HMAC-SHA1 signatures to authenticate each request
- Posts tweets using Twitter API v2
To reset credentials, run:
tweet --reset