README.md
author Mikael Berthe <mikael@lilotux.net>
Sat, 21 Oct 2017 19:17:07 +0200
changeset 173 1812a794b759
parent 156 bafe489779e5
child 181 0f3fb2d27ddb
permissions -rw-r--r--
Add a note about the API change to the README file
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
5abace724584 Initial public release
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     1
# madonctl
5abace724584 Initial public release
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     2
5abace724584 Initial public release
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     3
Golang command line interface for the Mastodon API
5abace724584 Initial public release
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     4
5abace724584 Initial public release
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     5
[![license](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)](https://raw.githubusercontent.com/McKael/madonctl/master/LICENSE)
2
b4a2df4425c4 Add Travis status badge
Mikael Berthe <mikael@lilotux.net>
parents: 0
diff changeset
     6
[![Build Status](https://travis-ci.org/McKael/madonctl.svg?branch=master)](https://travis-ci.org/McKael/madonctl)
0
5abace724584 Initial public release
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     7
5abace724584 Initial public release
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     8
`madonctl` is a [Go](https://golang.org/) CLI tool to use the Mastondon REST API.
5abace724584 Initial public release
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     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
5abace724584 Initial public release
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    12
## Installation
5abace724584 Initial public release
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    13
173
1812a794b759 Add a note about the API change to the README file
Mikael Berthe <mikael@lilotux.net>
parents: 156
diff changeset
    14
Please note that Mastodon 2.0.0 has a breaking API change (see issue #9).
1812a794b759 Add a note about the API change to the README file
Mikael Berthe <mikael@lilotux.net>
parents: 156
diff changeset
    15
1812a794b759 Add a note about the API change to the README file
Mikael Berthe <mikael@lilotux.net>
parents: 156
diff changeset
    16
`madonctl` v2.0.0+ is required for Mastodon 2.0.0+ server, but the new version
1812a794b759 Add a note about the API change to the README file
Mikael Berthe <mikael@lilotux.net>
parents: 156
diff changeset
    17
will not work with old servers.
1812a794b759 Add a note about the API change to the README file
Mikael Berthe <mikael@lilotux.net>
parents: 156
diff changeset
    18
4
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
    19
### From source
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
    20
37
9bc03db114c3 Add server statistics with gomif (using instances.mastodon.xyz API)
Mikael Berthe <mikael@lilotux.net>
parents: 32
diff changeset
    21
To install the application from source (you need to have Go >= 1.7), just type:
0
5abace724584 Initial public release
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    22
54
c31ca7e1ac24 Update README
Mikael Berthe <mikael@lilotux.net>
parents: 43
diff changeset
    23
    go get -u github.com/McKael/madonctl
0
5abace724584 Initial public release
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    24
4
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
    25
and you should be able to run `madonctl`.
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
    26
54
c31ca7e1ac24 Update README
Mikael Berthe <mikael@lilotux.net>
parents: 43
diff changeset
    27
For upgrades, don't forget the `-u` option to ensure the dependencies
c31ca7e1ac24 Update README
Mikael Berthe <mikael@lilotux.net>
parents: 43
diff changeset
    28
(especially [madon](https://github.com/McKael/madon)) are updated as well.
21
9e94836dc081 Update README
Mikael Berthe <mikael@lilotux.net>
parents: 19
diff changeset
    29
9e94836dc081 Update README
Mikael Berthe <mikael@lilotux.net>
parents: 19
diff changeset
    30
Travis automated testing is run for Go versions 1.7 and 1.8.
9e94836dc081 Update README
Mikael Berthe <mikael@lilotux.net>
parents: 19
diff changeset
    31
4
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
    32
### Download
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
    33
141
abaf660dc3fc Update documentation
Mikael Berthe <mikael@lilotux.net>
parents: 140
diff changeset
    34
Check the [Release page](https://github.com/McKael/madonctl/releases) for some
abaf660dc3fc Update documentation
Mikael Berthe <mikael@lilotux.net>
parents: 140
diff changeset
    35
pre-built binaries.
4
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
    36
141
abaf660dc3fc Update documentation
Mikael Berthe <mikael@lilotux.net>
parents: 140
diff changeset
    37
More pre-built binaries might be available from the [Homepage](https://lilotux.net/~mikael/pub/madonctl/)
abaf660dc3fc Update documentation
Mikael Berthe <mikael@lilotux.net>
parents: 140
diff changeset
    38
(development version and builds for a few other platforms).
0
5abace724584 Initial public release
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    39
5abace724584 Initial public release
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    40
## Usage
5abace724584 Initial public release
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    41
4
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
    42
### Configuration
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
    43
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
    44
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
    45
usually provide an account login/password (or a token).
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
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
    48
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
    49
107
093fc00b333d Update README
Mikael Berthe <mikael@lilotux.net>
parents: 105
diff changeset
    50
Note that you can **generate a configuration file** for your settings with
4
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
    51
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
    52
`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
    53
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
    54
(You can redirect the output to a configuration file.)
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
    55
115
8ae0dda7756d Update README
Mikael Berthe <mikael@lilotux.net>
parents: 108
diff changeset
    56
If you don't want to use the password or if you have enabled *Two-factor
137
8fdaf5e1f8fc Add configration.md with settings details
Mikael Berthe <mikael@lilotux.net>
parents: 129
diff changeset
    57
authentication*, you can also use **OAuth2** with the `oauth2` command:
4
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
    58
137
8fdaf5e1f8fc Add configration.md with settings details
Mikael Berthe <mikael@lilotux.net>
parents: 129
diff changeset
    59
`madonctl -i mastodon.social oauth2 > madonctl.yaml`
115
8ae0dda7756d Update README
Mikael Berthe <mikael@lilotux.net>
parents: 108
diff changeset
    60
137
8fdaf5e1f8fc Add configration.md with settings details
Mikael Berthe <mikael@lilotux.net>
parents: 129
diff changeset
    61
For details on the configuration, please check the [configuration](configuration.md) page.
79
bca27c55be9f Add default visibility setting
Mikael Berthe <mikael@lilotux.net>
parents: 75
diff changeset
    62
4
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
    63
### Usage
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
    64
141
abaf660dc3fc Update documentation
Mikael Berthe <mikael@lilotux.net>
parents: 140
diff changeset
    65
The complete list of commands is available in the online help (`madonctl help`,
abaf660dc3fc Update documentation
Mikael Berthe <mikael@lilotux.net>
parents: 140
diff changeset
    66
`madonctl command --help`...) or in the
abaf660dc3fc Update documentation
Mikael Berthe <mikael@lilotux.net>
parents: 140
diff changeset
    67
[manpages](https://lilotux.net/~mikael/pub/madonctl/manual/html/).
4
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
### Examples
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
    70
141
abaf660dc3fc Update documentation
Mikael Berthe <mikael@lilotux.net>
parents: 140
diff changeset
    71
This is a non-exhaustive list of commands, showing how madonctl works.
abaf660dc3fc Update documentation
Mikael Berthe <mikael@lilotux.net>
parents: 140
diff changeset
    72
4
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
    73
To post a simple "toot":
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
    74
``` sh
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
    75
% madonctl toot "Hello, World"
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
    76
```
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
    77
108
cc73f7cb0f21 Update README again (style)
Mikael Berthe <mikael@lilotux.net>
parents: 107
diff changeset
    78
You can change the toot visibility, add a Content Warning (a.k.a. spoiler)
cc73f7cb0f21 Update README again (style)
Mikael Berthe <mikael@lilotux.net>
parents: 107
diff changeset
    79
or send a media file:
4
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
    80
``` sh
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
    81
% madonctl toot --visibility direct "@McKael Hello, you"
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
    82
% 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
    83
% 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
    84
```
79
bca27c55be9f Add default visibility setting
Mikael Berthe <mikael@lilotux.net>
parents: 75
diff changeset
    85
Note: The default toot visibility can be set in the configuration file with
bca27c55be9f Add default visibility setting
Mikael Berthe <mikael@lilotux.net>
parents: 75
diff changeset
    86
the `default_visibility` setting or with the environment variable (example
bca27c55be9f Add default visibility setting
Mikael Berthe <mikael@lilotux.net>
parents: 75
diff changeset
    87
`export MADONCTL_DEFAULT_VISIBILITY=unlisted`).
4
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
    88
17
ab1aa9652791 Update documentation
Mikael Berthe <mikael@lilotux.net>
parents: 9
diff changeset
    89
Send (text) file content as new message:
ab1aa9652791 Update documentation
Mikael Berthe <mikael@lilotux.net>
parents: 9
diff changeset
    90
```
ab1aa9652791 Update documentation
Mikael Berthe <mikael@lilotux.net>
parents: 9
diff changeset
    91
% madonctl toot --text-file message.txt
ab1aa9652791 Update documentation
Mikael Berthe <mikael@lilotux.net>
parents: 9
diff changeset
    92
```
ab1aa9652791 Update documentation
Mikael Berthe <mikael@lilotux.net>
parents: 9
diff changeset
    93
72
8c7a2119dc9d Update README
Mikael Berthe <mikael@lilotux.net>
parents: 54
diff changeset
    94
... or read message from standard input:
8c7a2119dc9d Update README
Mikael Berthe <mikael@lilotux.net>
parents: 54
diff changeset
    95
```
8c7a2119dc9d Update README
Mikael Berthe <mikael@lilotux.net>
parents: 54
diff changeset
    96
% echo "Hello from #madonctl" | madonctl toot --stdin
8c7a2119dc9d Update README
Mikael Berthe <mikael@lilotux.net>
parents: 54
diff changeset
    97
```
8c7a2119dc9d Update README
Mikael Berthe <mikael@lilotux.net>
parents: 54
diff changeset
    98
129
11966471aac3 toot: Add flag --add-mentions to add mentions when replying
Mikael Berthe <mikael@lilotux.net>
parents: 115
diff changeset
    99
Reply to a message:
11966471aac3 toot: Add flag --add-mentions to add mentions when replying
Mikael Berthe <mikael@lilotux.net>
parents: 115
diff changeset
   100
``` sh
11966471aac3 toot: Add flag --add-mentions to add mentions when replying
Mikael Berthe <mikael@lilotux.net>
parents: 115
diff changeset
   101
% madonctl toot --in-reply-to 1234 --visibility direct "@user1 @user2 response"
11966471aac3 toot: Add flag --add-mentions to add mentions when replying
Mikael Berthe <mikael@lilotux.net>
parents: 115
diff changeset
   102
% madonctl toot --in-reply-to 1234 --add-mentions "response"
11966471aac3 toot: Add flag --add-mentions to add mentions when replying
Mikael Berthe <mikael@lilotux.net>
parents: 115
diff changeset
   103
```
11966471aac3 toot: Add flag --add-mentions to add mentions when replying
Mikael Berthe <mikael@lilotux.net>
parents: 115
diff changeset
   104
The flag `--add-mentions` automatically adds mentions based on the toot you're
11966471aac3 toot: Add flag --add-mentions to add mentions when replying
Mikael Berthe <mikael@lilotux.net>
parents: 115
diff changeset
   105
replying to.
11966471aac3 toot: Add flag --add-mentions to add mentions when replying
Mikael Berthe <mikael@lilotux.net>
parents: 115
diff changeset
   106
107
093fc00b333d Update README
Mikael Berthe <mikael@lilotux.net>
parents: 105
diff changeset
   107
Some **account-related commands**:
4
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
   108
``` sh
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
   109
% madonctl accounts blocked                       # List blocked accounts
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
   110
% madonctl accounts muted                         # List muted accounts
31
9dcb4491d7a1 Update README
Mikael Berthe <mikael@lilotux.net>
parents: 24
diff changeset
   111
% 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
   112
% 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
   113
% madonctl accounts notifications --notification-id 1234 # Display notification
140
92842a4f5f8b Remove notes for old versions in README
Mikael Berthe <mikael@lilotux.net>
parents: 137
diff changeset
   114
% madonctl accounts notifications --dismiss --notification-id 1234
4
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
   115
```
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
   116
32
cd657f7ec881 Update README
Mikael Berthe <mikael@lilotux.net>
parents: 31
diff changeset
   117
Note: By default, madonctl will send a single query.  If you want all available
cd657f7ec881 Update README
Mikael Berthe <mikael@lilotux.net>
parents: 31
diff changeset
   118
results you should use the `--all` flag.  If you use a `--limit` value,
cd657f7ec881 Update README
Mikael Berthe <mikael@lilotux.net>
parents: 31
diff changeset
   119
madonctl might send several queries until the number of results reaches this
cd657f7ec881 Update README
Mikael Berthe <mikael@lilotux.net>
parents: 31
diff changeset
   120
value.
cd657f7ec881 Update README
Mikael Berthe <mikael@lilotux.net>
parents: 31
diff changeset
   121
107
093fc00b333d Update README
Mikael Berthe <mikael@lilotux.net>
parents: 105
diff changeset
   122
**Update** your account information:
7
df3e9e068778 Update documentation wrt accounts update
Mikael Berthe <mikael@lilotux.net>
parents: 5
diff changeset
   123
``` sh
df3e9e068778 Update documentation wrt accounts update
Mikael Berthe <mikael@lilotux.net>
parents: 5
diff changeset
   124
% madonctl accounts update --display-name "John"  # Update display name
df3e9e068778 Update documentation wrt accounts update
Mikael Berthe <mikael@lilotux.net>
parents: 5
diff changeset
   125
% madonctl accounts update --note "Newcomer"      # Update user note (bio)
df3e9e068778 Update documentation wrt accounts update
Mikael Berthe <mikael@lilotux.net>
parents: 5
diff changeset
   126
% madonctl accounts update --note ""              # Clear note
df3e9e068778 Update documentation wrt accounts update
Mikael Berthe <mikael@lilotux.net>
parents: 5
diff changeset
   127
% madonctl accounts update --avatar me.png        # Update avatar
df3e9e068778 Update documentation wrt accounts update
Mikael Berthe <mikael@lilotux.net>
parents: 5
diff changeset
   128
```
df3e9e068778 Update documentation wrt accounts update
Mikael Berthe <mikael@lilotux.net>
parents: 5
diff changeset
   129
108
cc73f7cb0f21 Update README again (style)
Mikael Berthe <mikael@lilotux.net>
parents: 107
diff changeset
   130
See your own **posts**:
31
9dcb4491d7a1 Update README
Mikael Berthe <mikael@lilotux.net>
parents: 24
diff changeset
   131
``` sh
9dcb4491d7a1 Update README
Mikael Berthe <mikael@lilotux.net>
parents: 24
diff changeset
   132
% madonctl accounts statuses                      # See last posts
9dcb4491d7a1 Update README
Mikael Berthe <mikael@lilotux.net>
parents: 24
diff changeset
   133
% madonctl accounts statuses --all                # See all statuses
9dcb4491d7a1 Update README
Mikael Berthe <mikael@lilotux.net>
parents: 24
diff changeset
   134
```
9dcb4491d7a1 Update README
Mikael Berthe <mikael@lilotux.net>
parents: 24
diff changeset
   135
108
cc73f7cb0f21 Update README again (style)
Mikael Berthe <mikael@lilotux.net>
parents: 107
diff changeset
   136
Display accounts you're **following** or your **followers**:
31
9dcb4491d7a1 Update README
Mikael Berthe <mikael@lilotux.net>
parents: 24
diff changeset
   137
``` sh
9dcb4491d7a1 Update README
Mikael Berthe <mikael@lilotux.net>
parents: 24
diff changeset
   138
% madonctl accounts following                     # See last following
9dcb4491d7a1 Update README
Mikael Berthe <mikael@lilotux.net>
parents: 24
diff changeset
   139
% madonctl accounts following --all               # See all followed accounts
9dcb4491d7a1 Update README
Mikael Berthe <mikael@lilotux.net>
parents: 24
diff changeset
   140
% madonctl accounts followers --limit 30          # Last 30 followers
9dcb4491d7a1 Update README
Mikael Berthe <mikael@lilotux.net>
parents: 24
diff changeset
   141
```
9dcb4491d7a1 Update README
Mikael Berthe <mikael@lilotux.net>
parents: 24
diff changeset
   142
107
093fc00b333d Update README
Mikael Berthe <mikael@lilotux.net>
parents: 105
diff changeset
   143
Add/remove a **favourite**, **boost** a status...
4
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
   144
``` sh
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
   145
% madonctl status --status-id 416671 favourite    # Fave a status
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
   146
% madonctl status --status-id 416671 boost        # Boost a status
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
   147
```
0
5abace724584 Initial public release
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   148
5
d70f8e8f3d2e Add examples with accounts and timelines
Mikael Berthe <mikael@lilotux.net>
parents: 4
diff changeset
   149
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
   150
``` sh
d70f8e8f3d2e Add examples with accounts and timelines
Mikael Berthe <mikael@lilotux.net>
parents: 4
diff changeset
   151
% madonctl accounts search gargron
d70f8e8f3d2e Add examples with accounts and timelines
Mikael Berthe <mikael@lilotux.net>
parents: 4
diff changeset
   152
```
d70f8e8f3d2e Add examples with accounts and timelines
Mikael Berthe <mikael@lilotux.net>
parents: 4
diff changeset
   153
107
093fc00b333d Update README
Mikael Berthe <mikael@lilotux.net>
parents: 105
diff changeset
   154
**Follow** an account with known ID:
5
d70f8e8f3d2e Add examples with accounts and timelines
Mikael Berthe <mikael@lilotux.net>
parents: 4
diff changeset
   155
``` sh
d70f8e8f3d2e Add examples with accounts and timelines
Mikael Berthe <mikael@lilotux.net>
parents: 4
diff changeset
   156
% madonctl accounts follow --account-id 1234
d70f8e8f3d2e Add examples with accounts and timelines
Mikael Berthe <mikael@lilotux.net>
parents: 4
diff changeset
   157
```
d70f8e8f3d2e Add examples with accounts and timelines
Mikael Berthe <mikael@lilotux.net>
parents: 4
diff changeset
   158
4
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
   159
Follow a remote account:
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
   160
``` sh
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
   161
% madonctl accounts follow --remote Gargron@mastodon.social
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
   162
```
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
   163
107
093fc00b333d Update README
Mikael Berthe <mikael@lilotux.net>
parents: 105
diff changeset
   164
**Search** for accounts, statuses or hashtags:
105
07d96d963223 Update README
Mikael Berthe <mikael@lilotux.net>
parents: 102
diff changeset
   165
``` sh
07d96d963223 Update README
Mikael Berthe <mikael@lilotux.net>
parents: 102
diff changeset
   166
% madonctl search gargron
07d96d963223 Update README
Mikael Berthe <mikael@lilotux.net>
parents: 102
diff changeset
   167
% madonctl search mastodon
07d96d963223 Update README
Mikael Berthe <mikael@lilotux.net>
parents: 102
diff changeset
   168
```
07d96d963223 Update README
Mikael Berthe <mikael@lilotux.net>
parents: 102
diff changeset
   169
07d96d963223 Update README
Mikael Berthe <mikael@lilotux.net>
parents: 102
diff changeset
   170
When the account ID is unknown, --user-id can be useful.\
07d96d963223 Update README
Mikael Berthe <mikael@lilotux.net>
parents: 102
diff changeset
   171
You can specify the (instance-specific) account ID number (--account-id) or
07d96d963223 Update README
Mikael Berthe <mikael@lilotux.net>
parents: 102
diff changeset
   172
the user ID (--user-id).  In the later case, madonctl will search for the
07d96d963223 Update README
Mikael Berthe <mikael@lilotux.net>
parents: 102
diff changeset
   173
user so it must match exactly the ID known to your instance (without the
140
92842a4f5f8b Remove notes for old versions in README
Mikael Berthe <mikael@lilotux.net>
parents: 137
diff changeset
   174
@domain suffix if the user is on the same instance).  The --user-id flag can
92842a4f5f8b Remove notes for old versions in README
Mikael Berthe <mikael@lilotux.net>
parents: 137
diff changeset
   175
also contain an HTTP account URL.
105
07d96d963223 Update README
Mikael Berthe <mikael@lilotux.net>
parents: 102
diff changeset
   176
``` sh
153
9a683f43f75e Fix two incorrect README examples
Mikael Berthe <mikael@lilotux.net>
parents: 141
diff changeset
   177
% madonctl accounts --user-id Gargron@mastodon.social -l5 statuses # Last 5 statuses
9a683f43f75e Fix two incorrect README examples
Mikael Berthe <mikael@lilotux.net>
parents: 141
diff changeset
   178
% madonctl accounts --user-id https://mastodon.social/@Gargron -l5 statuses # Same
105
07d96d963223 Update README
Mikael Berthe <mikael@lilotux.net>
parents: 102
diff changeset
   179
```
156
bafe489779e5 Add a note about --user-id account format
Mikael Berthe <mikael@lilotux.net>
parents: 153
diff changeset
   180
Please note that the form "Gargron@mastodon.social" will only work if this
bafe489779e5 Add a note about --user-id account format
Mikael Berthe <mikael@lilotux.net>
parents: 153
diff changeset
   181
account is known by the instance.  If it is unknown, the https link should work
bafe489779e5 Add a note about --user-id account format
Mikael Berthe <mikael@lilotux.net>
parents: 153
diff changeset
   182
(and the Mastodon server will learn about the account).
105
07d96d963223 Update README
Mikael Berthe <mikael@lilotux.net>
parents: 102
diff changeset
   183
107
093fc00b333d Update README
Mikael Berthe <mikael@lilotux.net>
parents: 105
diff changeset
   184
Read **timelines**:
5
d70f8e8f3d2e Add examples with accounts and timelines
Mikael Berthe <mikael@lilotux.net>
parents: 4
diff changeset
   185
``` sh
d70f8e8f3d2e Add examples with accounts and timelines
Mikael Berthe <mikael@lilotux.net>
parents: 4
diff changeset
   186
% madonctl timeline                 # Display home timeline
d70f8e8f3d2e Add examples with accounts and timelines
Mikael Berthe <mikael@lilotux.net>
parents: 4
diff changeset
   187
% madonctl timeline public          # Display federated timeline
d70f8e8f3d2e Add examples with accounts and timelines
Mikael Berthe <mikael@lilotux.net>
parents: 4
diff changeset
   188
% madonctl timeline public --local  # Display public local timeline
24
9fcffbaa8cd0 Update README
Mikael Berthe <mikael@lilotux.net>
parents: 21
diff changeset
   189
9fcffbaa8cd0 Update README
Mikael Berthe <mikael@lilotux.net>
parents: 21
diff changeset
   190
% 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
   191
```
d70f8e8f3d2e Add examples with accounts and timelines
Mikael Berthe <mikael@lilotux.net>
parents: 4
diff changeset
   192
107
093fc00b333d Update README
Mikael Berthe <mikael@lilotux.net>
parents: 105
diff changeset
   193
Use the **streaming API** and fetch timelines and notifications:
4
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
   194
``` sh
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
   195
% madonctl stream                   # Stream home timeline and notifications
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
   196
% madonctl stream local             # Stream local timeline
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
   197
% madonctl stream public            # Stream federated timeline
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
   198
```
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
   199
107
093fc00b333d Update README
Mikael Berthe <mikael@lilotux.net>
parents: 105
diff changeset
   200
You can also use **hashtag streams**:
75
447ac88b67c6 Update README documentation wrt streams
Mikael Berthe <mikael@lilotux.net>
parents: 72
diff changeset
   201
``` sh
447ac88b67c6 Update README documentation wrt streams
Mikael Berthe <mikael@lilotux.net>
parents: 72
diff changeset
   202
% madonctl stream :mastodon         # Stream for hastag 'mastodon'
447ac88b67c6 Update README documentation wrt streams
Mikael Berthe <mikael@lilotux.net>
parents: 72
diff changeset
   203
% madonctl stream :madonctl,golang  # Stream for several hashtags
447ac88b67c6 Update README documentation wrt streams
Mikael Berthe <mikael@lilotux.net>
parents: 72
diff changeset
   204
```
447ac88b67c6 Update README documentation wrt streams
Mikael Berthe <mikael@lilotux.net>
parents: 72
diff changeset
   205
447ac88b67c6 Update README documentation wrt streams
Mikael Berthe <mikael@lilotux.net>
parents: 72
diff changeset
   206
Please note that madonctl will use one socket per stream, so the number of
447ac88b67c6 Update README documentation wrt streams
Mikael Berthe <mikael@lilotux.net>
parents: 72
diff changeset
   207
concurrent hashtags is currently limited to 4 for "politeness".
447ac88b67c6 Update README documentation wrt streams
Mikael Berthe <mikael@lilotux.net>
parents: 72
diff changeset
   208
115
8ae0dda7756d Update README
Mikael Berthe <mikael@lilotux.net>
parents: 108
diff changeset
   209
It is also possible to send every stream event (notification or status) to
8ae0dda7756d Update README
Mikael Berthe <mikael@lilotux.net>
parents: 108
diff changeset
   210
an **external command**.  You can can even combine it with a customized theme.
8ae0dda7756d Update README
Mikael Berthe <mikael@lilotux.net>
parents: 108
diff changeset
   211
The contents will be sent to the standard input of this command:
8ae0dda7756d Update README
Mikael Berthe <mikael@lilotux.net>
parents: 108
diff changeset
   212
``` sh
8ae0dda7756d Update README
Mikael Berthe <mikael@lilotux.net>
parents: 108
diff changeset
   213
madonctl stream --command gateway.sh --theme gateway
8ae0dda7756d Update README
Mikael Berthe <mikael@lilotux.net>
parents: 108
diff changeset
   214
```
75
447ac88b67c6 Update README documentation wrt streams
Mikael Berthe <mikael@lilotux.net>
parents: 72
diff changeset
   215
108
cc73f7cb0f21 Update README again (style)
Mikael Berthe <mikael@lilotux.net>
parents: 107
diff changeset
   216
(Almost) All commands have a **customizable output**:
4
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
   217
``` sh
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
   218
% madonctl accounts show            # Display an account
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
   219
% 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
   220
% 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
   221
% 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
   222
```
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
   223
107
093fc00b333d Update README
Mikael Berthe <mikael@lilotux.net>
parents: 105
diff changeset
   224
You can also use Go (Golang) **templates**:
4
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
   225
``` sh
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
   226
% madonctl accounts --account-id 1 followers --template '{{.acct}}{{"\n"}}'
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
   227
```
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
   228
102
84ad56b643c8 Allow HTTP URLs in --user-id
Mikael Berthe <mikael@lilotux.net>
parents: 98
diff changeset
   229
Number of users on current instance (statistics from instances.mastodon.xyz API):
37
9bc03db114c3 Add server statistics with gomif (using instances.mastodon.xyz API)
Mikael Berthe <mikael@lilotux.net>
parents: 32
diff changeset
   230
```
9bc03db114c3 Add server statistics with gomif (using instances.mastodon.xyz API)
Mikael Berthe <mikael@lilotux.net>
parents: 32
diff changeset
   231
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
   232
```
9bc03db114c3 Add server statistics with gomif (using instances.mastodon.xyz API)
Mikael Berthe <mikael@lilotux.net>
parents: 32
diff changeset
   233
140
92842a4f5f8b Remove notes for old versions in README
Mikael Berthe <mikael@lilotux.net>
parents: 137
diff changeset
   234
You can write and use [themes](templates) as well:
92
aa7d918e727d Update README
Mikael Berthe <mikael@lilotux.net>
parents: 79
diff changeset
   235
```
aa7d918e727d Update README
Mikael Berthe <mikael@lilotux.net>
parents: 79
diff changeset
   236
madonctl --theme=ansi timeline
aa7d918e727d Update README
Mikael Berthe <mikael@lilotux.net>
parents: 79
diff changeset
   237
```
aa7d918e727d Update README
Mikael Berthe <mikael@lilotux.net>
parents: 79
diff changeset
   238
4
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
   239
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
   240
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
   241
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
   242
### Shell completion
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
   243
107
093fc00b333d Update README
Mikael Berthe <mikael@lilotux.net>
parents: 105
diff changeset
   244
If you want **shell completion**, you can generate scripts with the following command: \
4
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
   245
`madonctl completion bash` (or zsh)
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
   246
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
   247
Then, just source the script in your shell.
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
   248
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
   249
For example, I have this line in my .zshrc:
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
   250
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
   251
`source <(madonctl completion zsh)`
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
   252
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
   253
### Commands output
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
   254
107
093fc00b333d Update README
Mikael Berthe <mikael@lilotux.net>
parents: 105
diff changeset
   255
The output can be set to **json**, **yaml** or to a **Go template** for all commands.\
4
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
   256
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
   257
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
   258
For example, you can display your user token with:\
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
   259
`madonctl config whoami --template '{{.access_token}}'`\
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
   260
or the application ID with:\
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
   261
`madonctl config dump --template '{{.ID}}'`
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
   262
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
   263
All the users that have favorited a given status:\
a3b95e2f0b0b Update README - add some documentation
Mikael Berthe <mikael@lilotux.net>
parents: 2
diff changeset
   264
`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
   265
107
093fc00b333d Update README
Mikael Berthe <mikael@lilotux.net>
parents: 105
diff changeset
   266
Sets of templates can be grouped as **themes**.
105
07d96d963223 Update README
Mikael Berthe <mikael@lilotux.net>
parents: 102
diff changeset
   267
24
9fcffbaa8cd0 Update README
Mikael Berthe <mikael@lilotux.net>
parents: 21
diff changeset
   268
For more complex templates, one can use the `--template-file` option.\
105
07d96d963223 Update README
Mikael Berthe <mikael@lilotux.net>
parents: 102
diff changeset
   269
See the [themes & templates](templates) folder.
0
5abace724584 Initial public release
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   270
5abace724584 Initial public release
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   271
## References
5abace724584 Initial public release
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   272
141
abaf660dc3fc Update documentation
Mikael Berthe <mikael@lilotux.net>
parents: 140
diff changeset
   273
- [madonctl manpages](https://lilotux.net/~mikael/pub/madonctl/manual/html/)
0
5abace724584 Initial public release
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   274
- [madon](https://github.com/McKael/madon), the Go library for Mastodon API
5abace724584 Initial public release
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   275
- [Mastodon API documentation](https://github.com/tootsuite/documentation/blob/master/Using-the-API/API.md)
5abace724584 Initial public release
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
   276
- [Mastodon repository](https://github.com/tootsuite/mastodon)