author | Mikael Berthe <mikael@lilotux.net> |
Mon, 01 May 2017 22:12:05 +0200 | |
changeset 62 | d6d768380860 |
parent 54 | c31ca7e1ac24 |
child 72 | 8c7a2119dc9d |
permissions | -rw-r--r-- |
0 | 1 |
# madonctl |
2 |
||
3 |
Golang command line interface for the Mastodon API |
|
4 |
||
5 |
[![license](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)](https://raw.githubusercontent.com/McKael/madonctl/master/LICENSE) |
|
2 | 6 |
[![Build Status](https://travis-ci.org/McKael/madonctl.svg?branch=master)](https://travis-ci.org/McKael/madonctl) |
0 | 7 |
|
8 |
`madonctl` is a [Go](https://golang.org/) CLI tool to use the Mastondon REST API. |
|
9 |
||
4
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
10 |
It is built on top of [madon](https://github.com/McKael/madon), my Golang implementation of the API. |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
11 |
|
0 | 12 |
## Installation |
13 |
||
4
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
14 |
### From source |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
15 |
|
37
9bc03db114c3
Add server statistics with gomif (using instances.mastodon.xyz API)
Mikael Berthe <mikael@lilotux.net>
parents:
32
diff
changeset
|
16 |
To install the application from source (you need to have Go >= 1.7), just type: |
0 | 17 |
|
54 | 18 |
go get -u github.com/McKael/madonctl |
0 | 19 |
|
4
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
20 |
and you should be able to run `madonctl`. |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
21 |
|
54 | 22 |
For upgrades, don't forget the `-u` option to ensure the dependencies |
23 |
(especially [madon](https://github.com/McKael/madon)) are updated as well. |
|
21 | 24 |
|
25 |
Travis automated testing is run for Go versions 1.7 and 1.8. |
|
26 |
||
4
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
27 |
### Download |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
28 |
|
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
29 |
Check the [Release page](https://github.com/McKael/madonctl/releases) for some pre-built binaries. |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
30 |
|
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
31 |
More pre-built binaries are available from the [Homepage](https://lilotux.net/~mikael/pub/madonctl/) (development version and builds for a few other platforms). |
0 | 32 |
|
33 |
## Usage |
|
34 |
||
4
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
35 |
### Configuration |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
36 |
|
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
37 |
In order to use madonctl, you need to specify the instance name or URL, and |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
38 |
usually provide an account login/password (or a token). |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
39 |
|
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
40 |
These settings can be passed as command line arguments or environment variables, |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
41 |
but the easiest way is to use a configuration file. |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
42 |
|
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
43 |
Note that you can generate a configuration file for your settings with |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
44 |
|
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
45 |
`madonctl config dump -i mastodon.social -L username@domain -P password` |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
46 |
|
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
47 |
(You can redirect the output to a configuration file.) |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
48 |
|
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
49 |
If you only provide the Mastodon instance, it will generate a configuration file with an application ID/secret for this instance and you will have to add the user credentials. |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
50 |
|
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
51 |
### Usage |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
52 |
|
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
53 |
The complete list of commands is available in the online help (`madonctl help`, `madonctl command --help`...) |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
54 |
or in the [manpages](https://lilotux.net/~mikael/pub/madonctl/manual/html/). The [Homepage](https://lilotux.net/~mikael/pub/madonctl/) also contains a plain list of commands. |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
55 |
|
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
56 |
### Examples |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
57 |
|
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
58 |
To post a simple "toot": |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
59 |
``` sh |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
60 |
% madonctl toot "Hello, World" |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
61 |
``` |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
62 |
|
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
63 |
You can change the toot visibility, add a Content Warning (a.k.a. spoiler) or send a media file: |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
64 |
``` sh |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
65 |
% madonctl toot --visibility direct "@McKael Hello, you" |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
66 |
% madonctl toot --visibility private --spoiler CW "The answer was 42" |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
67 |
% madonctl post --file image.jpg Selfie # Send a media file |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
68 |
``` |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
69 |
|
17 | 70 |
Send (text) file content as new message: |
71 |
``` |
|
72 |
% madonctl toot --text-file message.txt |
|
73 |
``` |
|
74 |
||
4
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
75 |
Some account-related commands: |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
76 |
``` sh |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
77 |
% madonctl accounts blocked # List blocked accounts |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
78 |
% madonctl accounts muted # List muted accounts |
31 | 79 |
% madonctl accounts notifications --list --all # List really all notifications |
4
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
80 |
% madonctl accounts notifications --list --clear # List and clear notifications |
19
4c81f4393773
Add notification --dismiss to clear a single notification
Mikael Berthe <mikael@lilotux.net>
parents:
17
diff
changeset
|
81 |
% madonctl accounts notifications --notification-id 1234 # Display notification |
4c81f4393773
Add notification --dismiss to clear a single notification
Mikael Berthe <mikael@lilotux.net>
parents:
17
diff
changeset
|
82 |
% madonctl accounts notifications --dismiss --notification-id 1234 # Mastodon 1.3+ |
4
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
83 |
``` |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
84 |
|
32 | 85 |
Note: By default, madonctl will send a single query. If you want all available |
86 |
results you should use the `--all` flag. If you use a `--limit` value, |
|
87 |
madonctl might send several queries until the number of results reaches this |
|
88 |
value. |
|
89 |
||
7
df3e9e068778
Update documentation wrt accounts update
Mikael Berthe <mikael@lilotux.net>
parents:
5
diff
changeset
|
90 |
Update your account information: |
df3e9e068778
Update documentation wrt accounts update
Mikael Berthe <mikael@lilotux.net>
parents:
5
diff
changeset
|
91 |
``` sh |
df3e9e068778
Update documentation wrt accounts update
Mikael Berthe <mikael@lilotux.net>
parents:
5
diff
changeset
|
92 |
% madonctl accounts update --display-name "John" # Update display name |
df3e9e068778
Update documentation wrt accounts update
Mikael Berthe <mikael@lilotux.net>
parents:
5
diff
changeset
|
93 |
% madonctl accounts update --note "Newcomer" # Update user note (bio) |
df3e9e068778
Update documentation wrt accounts update
Mikael Berthe <mikael@lilotux.net>
parents:
5
diff
changeset
|
94 |
% madonctl accounts update --note "" # Clear note |
df3e9e068778
Update documentation wrt accounts update
Mikael Berthe <mikael@lilotux.net>
parents:
5
diff
changeset
|
95 |
% madonctl accounts update --avatar me.png # Update avatar |
df3e9e068778
Update documentation wrt accounts update
Mikael Berthe <mikael@lilotux.net>
parents:
5
diff
changeset
|
96 |
``` |
df3e9e068778
Update documentation wrt accounts update
Mikael Berthe <mikael@lilotux.net>
parents:
5
diff
changeset
|
97 |
|
31 | 98 |
See your own posts: |
99 |
``` sh |
|
100 |
% madonctl accounts statuses # See last posts |
|
101 |
% madonctl accounts statuses --all # See all statuses |
|
102 |
% madonctl accounts --user-id Gargron@mastodon.social -l5 # Last 5 statuses |
|
103 |
``` |
|
104 |
||
105 |
You can specify the (instance-specific) account ID number (--account-id) or |
|
106 |
the user ID (--user-id). In the later case, madonctl will search for the |
|
107 |
user so it must match exactly the ID known to your instance (without the |
|
108 |
@domain suffix if the user is on the same instance). |
|
109 |
||
110 |
Display accounts you're following or your followers: |
|
111 |
``` sh |
|
112 |
% madonctl accounts following # See last following |
|
113 |
% madonctl accounts following --all # See all followed accounts |
|
114 |
% madonctl accounts followers --limit 30 # Last 30 followers |
|
115 |
``` |
|
116 |
||
4
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
117 |
Add/remove a favourite, boost a status... |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
118 |
``` sh |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
119 |
% madonctl status --status-id 416671 favourite # Fave a status |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
120 |
% madonctl status --status-id 416671 boost # Boost a status |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
121 |
``` |
0 | 122 |
|
5
d70f8e8f3d2e
Add examples with accounts and timelines
Mikael Berthe <mikael@lilotux.net>
parents:
4
diff
changeset
|
123 |
Search for an account (only accounts known to your instance): |
d70f8e8f3d2e
Add examples with accounts and timelines
Mikael Berthe <mikael@lilotux.net>
parents:
4
diff
changeset
|
124 |
``` sh |
d70f8e8f3d2e
Add examples with accounts and timelines
Mikael Berthe <mikael@lilotux.net>
parents:
4
diff
changeset
|
125 |
% madonctl accounts search gargron |
d70f8e8f3d2e
Add examples with accounts and timelines
Mikael Berthe <mikael@lilotux.net>
parents:
4
diff
changeset
|
126 |
``` |
d70f8e8f3d2e
Add examples with accounts and timelines
Mikael Berthe <mikael@lilotux.net>
parents:
4
diff
changeset
|
127 |
|
d70f8e8f3d2e
Add examples with accounts and timelines
Mikael Berthe <mikael@lilotux.net>
parents:
4
diff
changeset
|
128 |
Follow an account with known ID: |
d70f8e8f3d2e
Add examples with accounts and timelines
Mikael Berthe <mikael@lilotux.net>
parents:
4
diff
changeset
|
129 |
``` sh |
d70f8e8f3d2e
Add examples with accounts and timelines
Mikael Berthe <mikael@lilotux.net>
parents:
4
diff
changeset
|
130 |
% madonctl accounts follow --account-id 1234 |
d70f8e8f3d2e
Add examples with accounts and timelines
Mikael Berthe <mikael@lilotux.net>
parents:
4
diff
changeset
|
131 |
``` |
d70f8e8f3d2e
Add examples with accounts and timelines
Mikael Berthe <mikael@lilotux.net>
parents:
4
diff
changeset
|
132 |
|
4
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
133 |
Follow a remote account: |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
134 |
``` sh |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
135 |
% madonctl accounts follow --remote Gargron@mastodon.social |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
136 |
``` |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
137 |
|
5
d70f8e8f3d2e
Add examples with accounts and timelines
Mikael Berthe <mikael@lilotux.net>
parents:
4
diff
changeset
|
138 |
Read timelines: |
d70f8e8f3d2e
Add examples with accounts and timelines
Mikael Berthe <mikael@lilotux.net>
parents:
4
diff
changeset
|
139 |
``` sh |
d70f8e8f3d2e
Add examples with accounts and timelines
Mikael Berthe <mikael@lilotux.net>
parents:
4
diff
changeset
|
140 |
% madonctl timeline # Display home timeline |
d70f8e8f3d2e
Add examples with accounts and timelines
Mikael Berthe <mikael@lilotux.net>
parents:
4
diff
changeset
|
141 |
% madonctl timeline public # Display federated timeline |
d70f8e8f3d2e
Add examples with accounts and timelines
Mikael Berthe <mikael@lilotux.net>
parents:
4
diff
changeset
|
142 |
% madonctl timeline public --local # Display public local timeline |
24 | 143 |
|
144 |
% madonctl timeline --limit 3 # Display 3 latest home timeline messages |
|
5
d70f8e8f3d2e
Add examples with accounts and timelines
Mikael Berthe <mikael@lilotux.net>
parents:
4
diff
changeset
|
145 |
``` |
d70f8e8f3d2e
Add examples with accounts and timelines
Mikael Berthe <mikael@lilotux.net>
parents:
4
diff
changeset
|
146 |
|
4
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
147 |
Use the streaming API and fetch timelines and notifications: |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
148 |
``` sh |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
149 |
% madonctl stream # Stream home timeline and notifications |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
150 |
% madonctl stream local # Stream local timeline |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
151 |
% madonctl stream public # Stream federated timeline |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
152 |
``` |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
153 |
|
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
154 |
(Almost) All commands have a customisable outpput |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
155 |
``` sh |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
156 |
% madonctl accounts show # Display an account |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
157 |
% madonctl accounts show -o yaml # Display an account, in yaml |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
158 |
% madonctl accounts show -o json # Display an account, in json |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
159 |
% madonctl stream local -o json # Stream local timeline and output to JSON |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
160 |
``` |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
161 |
|
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
162 |
You can also use Go (Golang) templates: |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
163 |
``` sh |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
164 |
% madonctl accounts --account-id 1 followers --template '{{.acct}}{{"\n"}}' |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
165 |
``` |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
166 |
|
37
9bc03db114c3
Add server statistics with gomif (using instances.mastodon.xyz API)
Mikael Berthe <mikael@lilotux.net>
parents:
32
diff
changeset
|
167 |
Number of users on current instance (madonctl 1.5+) (statistics from instances.mastodon.xyz API): |
9bc03db114c3
Add server statistics with gomif (using instances.mastodon.xyz API)
Mikael Berthe <mikael@lilotux.net>
parents:
32
diff
changeset
|
168 |
``` |
9bc03db114c3
Add server statistics with gomif (using instances.mastodon.xyz API)
Mikael Berthe <mikael@lilotux.net>
parents:
32
diff
changeset
|
169 |
madonctl instance --stats --template '{{printf "%v\n" .users}}' |
9bc03db114c3
Add server statistics with gomif (using instances.mastodon.xyz API)
Mikael Berthe <mikael@lilotux.net>
parents:
32
diff
changeset
|
170 |
``` |
9bc03db114c3
Add server statistics with gomif (using instances.mastodon.xyz API)
Mikael Berthe <mikael@lilotux.net>
parents:
32
diff
changeset
|
171 |
|
4
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
172 |
There are many more commands, you can find them in the online help or the manpage. |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
173 |
|
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
174 |
|
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
175 |
### Shell completion |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
176 |
|
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
177 |
If you want shell completion, you can generate scripts with the following command: \ |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
178 |
`madonctl completion bash` (or zsh) |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
179 |
|
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
180 |
Then, just source the script in your shell. |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
181 |
|
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
182 |
For example, I have this line in my .zshrc: |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
183 |
|
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
184 |
`source <(madonctl completion zsh)` |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
185 |
|
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
186 |
### Commands output |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
187 |
|
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
188 |
The output can be set to json, yaml or to a Go template for all commands.\ |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
189 |
If you are familiar with Kubernetes' kubectl, it is very similar. |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
190 |
|
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
191 |
For example, you can display your user token with:\ |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
192 |
`madonctl config whoami --template '{{.access_token}}'`\ |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
193 |
or the application ID with:\ |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
194 |
`madonctl config dump --template '{{.ID}}'` |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
195 |
|
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
196 |
All the users that have favorited a given status:\ |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
197 |
`madonctl status --status-id 101194 favourited-by --template '{{.username}}{{"\n"}}'` |
a3b95e2f0b0b
Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents:
2
diff
changeset
|
198 |
|
24 | 199 |
For more complex templates, one can use the `--template-file` option.\ |
200 |
See the [templates](templates) folder. |
|
0 | 201 |
|
202 |
## References |
|
203 |
||
204 |
- [madon](https://github.com/McKael/madon), the Go library for Mastodon API |
|
205 |
- [Mastodon API documentation](https://github.com/tootsuite/documentation/blob/master/Using-the-API/API.md) |
|
206 |
- [Mastodon repository](https://github.com/tootsuite/mastodon) |