38 usually provide an account login/password (or a token). |
38 usually provide an account login/password (or a token). |
39 |
39 |
40 These settings can be passed as command line arguments or environment variables, |
40 These settings can be passed as command line arguments or environment variables, |
41 but the easiest way is to use a configuration file. |
41 but the easiest way is to use a configuration file. |
42 |
42 |
43 Note that you can *generate a configuration file* for your settings with |
43 Note that you can **generate a configuration file** for your settings with |
44 |
44 |
45 `madonctl config dump -i mastodon.social -L username@domain -P password` |
45 `madonctl config dump -i mastodon.social -L username@domain -P password` |
46 |
46 |
47 (You can redirect the output to a configuration file.) |
47 (You can redirect the output to a configuration file.) |
48 |
48 |
80 ... or read message from standard input: |
80 ... or read message from standard input: |
81 ``` |
81 ``` |
82 % echo "Hello from #madonctl" | madonctl toot --stdin |
82 % echo "Hello from #madonctl" | madonctl toot --stdin |
83 ``` |
83 ``` |
84 |
84 |
85 Some *account-related commands*: |
85 Some **account-related commands**: |
86 ``` sh |
86 ``` sh |
87 % madonctl accounts blocked # List blocked accounts |
87 % madonctl accounts blocked # List blocked accounts |
88 % madonctl accounts muted # List muted accounts |
88 % madonctl accounts muted # List muted accounts |
89 % madonctl accounts notifications --list --all # List really all notifications |
89 % madonctl accounts notifications --list --all # List really all notifications |
90 % madonctl accounts notifications --list --clear # List and clear notifications |
90 % madonctl accounts notifications --list --clear # List and clear notifications |
95 Note: By default, madonctl will send a single query. If you want all available |
95 Note: By default, madonctl will send a single query. If you want all available |
96 results you should use the `--all` flag. If you use a `--limit` value, |
96 results you should use the `--all` flag. If you use a `--limit` value, |
97 madonctl might send several queries until the number of results reaches this |
97 madonctl might send several queries until the number of results reaches this |
98 value. |
98 value. |
99 |
99 |
100 Update your account information: |
100 **Update** your account information: |
101 ``` sh |
101 ``` sh |
102 % madonctl accounts update --display-name "John" # Update display name |
102 % madonctl accounts update --display-name "John" # Update display name |
103 % madonctl accounts update --note "Newcomer" # Update user note (bio) |
103 % madonctl accounts update --note "Newcomer" # Update user note (bio) |
104 % madonctl accounts update --note "" # Clear note |
104 % madonctl accounts update --note "" # Clear note |
105 % madonctl accounts update --avatar me.png # Update avatar |
105 % madonctl accounts update --avatar me.png # Update avatar |
116 % madonctl accounts following # See last following |
116 % madonctl accounts following # See last following |
117 % madonctl accounts following --all # See all followed accounts |
117 % madonctl accounts following --all # See all followed accounts |
118 % madonctl accounts followers --limit 30 # Last 30 followers |
118 % madonctl accounts followers --limit 30 # Last 30 followers |
119 ``` |
119 ``` |
120 |
120 |
121 Add/remove a *favourite*, *boost* a status... |
121 Add/remove a **favourite**, **boost** a status... |
122 ``` sh |
122 ``` sh |
123 % madonctl status --status-id 416671 favourite # Fave a status |
123 % madonctl status --status-id 416671 favourite # Fave a status |
124 % madonctl status --status-id 416671 boost # Boost a status |
124 % madonctl status --status-id 416671 boost # Boost a status |
125 ``` |
125 ``` |
126 |
126 |
127 Search for an account (only accounts known to your instance): |
127 Search for an account (only accounts known to your instance): |
128 ``` sh |
128 ``` sh |
129 % madonctl accounts search gargron |
129 % madonctl accounts search gargron |
130 ``` |
130 ``` |
131 |
131 |
132 *Follow* an account with known ID: |
132 **Follow** an account with known ID: |
133 ``` sh |
133 ``` sh |
134 % madonctl accounts follow --account-id 1234 |
134 % madonctl accounts follow --account-id 1234 |
135 ``` |
135 ``` |
136 |
136 |
137 Follow a remote account: |
137 Follow a remote account: |
138 ``` sh |
138 ``` sh |
139 % madonctl accounts follow --remote Gargron@mastodon.social |
139 % madonctl accounts follow --remote Gargron@mastodon.social |
140 ``` |
140 ``` |
141 |
141 |
142 *Search* for accounts, statuses or hashtags: |
142 **Search** for accounts, statuses or hashtags: |
143 ``` sh |
143 ``` sh |
144 % madonctl search gargron |
144 % madonctl search gargron |
145 % madonctl search mastodon |
145 % madonctl search mastodon |
146 ``` |
146 ``` |
147 |
147 |
154 ``` sh |
154 ``` sh |
155 % madonctl accounts --user-id Gargron@mastodon.social -l5 # Last 5 statuses |
155 % madonctl accounts --user-id Gargron@mastodon.social -l5 # Last 5 statuses |
156 % madonctl accounts --user-id https://mastodon.social/@Gargron -l5 # Same |
156 % madonctl accounts --user-id https://mastodon.social/@Gargron -l5 # Same |
157 ``` |
157 ``` |
158 |
158 |
159 Read *timelines*: |
159 Read **timelines**: |
160 ``` sh |
160 ``` sh |
161 % madonctl timeline # Display home timeline |
161 % madonctl timeline # Display home timeline |
162 % madonctl timeline public # Display federated timeline |
162 % madonctl timeline public # Display federated timeline |
163 % madonctl timeline public --local # Display public local timeline |
163 % madonctl timeline public --local # Display public local timeline |
164 |
164 |
165 % madonctl timeline --limit 3 # Display 3 latest home timeline messages |
165 % madonctl timeline --limit 3 # Display 3 latest home timeline messages |
166 ``` |
166 ``` |
167 |
167 |
168 Use the *streaming API* and fetch timelines and notifications: |
168 Use the **streaming API** and fetch timelines and notifications: |
169 ``` sh |
169 ``` sh |
170 % madonctl stream # Stream home timeline and notifications |
170 % madonctl stream # Stream home timeline and notifications |
171 % madonctl stream local # Stream local timeline |
171 % madonctl stream local # Stream local timeline |
172 % madonctl stream public # Stream federated timeline |
172 % madonctl stream public # Stream federated timeline |
173 ``` |
173 ``` |
174 |
174 |
175 You can also use *hashtag streams*: |
175 You can also use **hashtag streams**: |
176 ``` sh |
176 ``` sh |
177 % madonctl stream :mastodon # Stream for hastag 'mastodon' |
177 % madonctl stream :mastodon # Stream for hastag 'mastodon' |
178 % madonctl stream :madonctl,golang # Stream for several hashtags |
178 % madonctl stream :madonctl,golang # Stream for several hashtags |
179 ``` |
179 ``` |
180 |
180 |
181 Please note that madonctl will use one socket per stream, so the number of |
181 Please note that madonctl will use one socket per stream, so the number of |
182 concurrent hashtags is currently limited to 4 for "politeness". |
182 concurrent hashtags is currently limited to 4 for "politeness". |
183 |
183 |
184 |
184 |
185 (Almost) All commands have a *customisable output*: |
185 (Almost) All commands have a **customisable output**: |
186 ``` sh |
186 ``` sh |
187 % madonctl accounts show # Display an account |
187 % madonctl accounts show # Display an account |
188 % madonctl accounts show -o yaml # Display an account, in yaml |
188 % madonctl accounts show -o yaml # Display an account, in yaml |
189 % madonctl accounts show -o json # Display an account, in json |
189 % madonctl accounts show -o json # Display an account, in json |
190 % madonctl stream local -o json # Stream local timeline and output to JSON |
190 % madonctl stream local -o json # Stream local timeline and output to JSON |
191 ``` |
191 ``` |
192 |
192 |
193 You can also use Go (Golang) *templates*: |
193 You can also use Go (Golang) **templates**: |
194 ``` sh |
194 ``` sh |
195 % madonctl accounts --account-id 1 followers --template '{{.acct}}{{"\n"}}' |
195 % madonctl accounts --account-id 1 followers --template '{{.acct}}{{"\n"}}' |
196 ``` |
196 ``` |
197 |
197 |
198 Number of users on current instance (statistics from instances.mastodon.xyz API): |
198 Number of users on current instance (statistics from instances.mastodon.xyz API): |
208 There are many more commands, you can find them in the online help or the manpage. |
208 There are many more commands, you can find them in the online help or the manpage. |
209 |
209 |
210 |
210 |
211 ### Shell completion |
211 ### Shell completion |
212 |
212 |
213 If you want *shell completion*, you can generate scripts with the following command: \ |
213 If you want **shell completion**, you can generate scripts with the following command: \ |
214 `madonctl completion bash` (or zsh) |
214 `madonctl completion bash` (or zsh) |
215 |
215 |
216 Then, just source the script in your shell. |
216 Then, just source the script in your shell. |
217 |
217 |
218 For example, I have this line in my .zshrc: |
218 For example, I have this line in my .zshrc: |
219 |
219 |
220 `source <(madonctl completion zsh)` |
220 `source <(madonctl completion zsh)` |
221 |
221 |
222 ### Commands output |
222 ### Commands output |
223 |
223 |
224 The output can be set to *json*, *yaml* or to a *Go template* for all commands.\ |
224 The output can be set to **json**, **yaml** or to a **Go template** for all commands.\ |
225 If you are familiar with Kubernetes' kubectl, it is very similar. |
225 If you are familiar with Kubernetes' kubectl, it is very similar. |
226 |
226 |
227 For example, you can display your user token with:\ |
227 For example, you can display your user token with:\ |
228 `madonctl config whoami --template '{{.access_token}}'`\ |
228 `madonctl config whoami --template '{{.access_token}}'`\ |
229 or the application ID with:\ |
229 or the application ID with:\ |
230 `madonctl config dump --template '{{.ID}}'` |
230 `madonctl config dump --template '{{.ID}}'` |
231 |
231 |
232 All the users that have favorited a given status:\ |
232 All the users that have favorited a given status:\ |
233 `madonctl status --status-id 101194 favourited-by --template '{{.username}}{{"\n"}}'` |
233 `madonctl status --status-id 101194 favourited-by --template '{{.username}}{{"\n"}}'` |
234 |
234 |
235 Sets of templates can be grouped as *themes*. |
235 Sets of templates can be grouped as **themes**. |
236 |
236 |
237 For more complex templates, one can use the `--template-file` option.\ |
237 For more complex templates, one can use the `--template-file` option.\ |
238 See the [themes & templates](templates) folder. |
238 See the [themes & templates](templates) folder. |
239 |
239 |
240 ## References |
240 ## References |