{"id":13546540,"url":"https://github.com/McKael/madonctl","last_synced_at":"2025-04-02T18:31:03.060Z","repository":{"id":49960563,"uuid":"88770779","full_name":"McKael/madonctl","owner":"McKael","description":"CLI client for the Mastodon social network API","archived":false,"fork":false,"pushed_at":"2023-10-11T23:36:22.000Z","size":6537,"stargazers_count":191,"open_issues_count":8,"forks_count":9,"subscribers_count":12,"default_branch":"master","last_synced_at":"2024-05-23T04:04:39.635Z","etag":null,"topics":["application","cli","client","console","go","golang","mastodon","mastodon-api"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/McKael.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2017-04-19T17:13:43.000Z","updated_at":"2024-05-12T16:48:26.000Z","dependencies_parsed_at":"2023-11-24T09:03:24.948Z","dependency_job_id":"9a957ee3-10c4-4062-ada4-dd42f3c70213","html_url":"https://github.com/McKael/madonctl","commit_stats":{"total_commits":257,"total_committers":6,"mean_commits":"42.833333333333336","dds":0.01945525291828798,"last_synced_commit":"fe630fcc361c207d96044720b5c3ea5d9a1c8d20"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/McKael%2Fmadonctl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/McKael%2Fmadonctl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/McKael%2Fmadonctl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/McKael%2Fmadonctl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/McKael","download_url":"https://codeload.github.com/McKael/madonctl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246869727,"owners_count":20847181,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["application","cli","client","console","go","golang","mastodon","mastodon-api"],"created_at":"2024-08-01T12:00:39.849Z","updated_at":"2025-04-02T18:31:02.116Z","avatar_url":"https://github.com/McKael.png","language":"Go","funding_links":[],"categories":["Clients","Go","客户端"],"sub_categories":["CLI"],"readme":"# madonctl\n\nGolang command line interface for the Mastodon API\n\n[![license](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)](https://raw.githubusercontent.com/McKael/madonctl/master/LICENSE)\n\n`madonctl` is a [Go](https://golang.org/) CLI tool to use the Mastodon REST API.\n\nIt is built on top of [madon](https://github.com/McKael/madon), my Golang\nimplementation of the API.\n\n## Installation\n\n### Download\n\nCheck the [Release page](https://github.com/McKael/madonctl/releases) for some\npre-built binaries.\n\nMore pre-built binaries might be available from the [Homepage](https://lilotux.net/~mikael/pub/madonctl/)\n(development version and builds for a few other platforms).\n\n### From source\n\nmadonctl uses Go modules (dependencies have been vendored for convenience).\n\nYou can install the latest `madonctl` release with the usual Go command:\n\n    go install github.com/McKael/madonctl/v3@latest\n\nOr if you want the current master branch:\n\n    go install github.com/McKael/madonctl/v3@master\n\nAlternatively:\n\n    git clone https://github.com/McKael/madonctl\n    cd madonctl\n    go build    # (or go install)\n\nand you should be able to use `madonctl`.\n\n## Usage\n\n### Configuration\n\nIn order to use madonctl, you need to specify the instance name or URL, and\nusually provide an account login/password (or a token).\n\nThese settings can be passed as command line arguments or environment variables,\nbut the easiest way is to use a configuration file.\n\nNote that you can **generate a configuration file** for your settings with\n\n`madonctl config dump -i mastodon.social -L username@domain -P password`\n\n(You can redirect the output to a configuration file.)\n\nIf you don't want to use the password or if you have enabled *Two-factor\nauthentication*, you can also use **OAuth2** with the `oauth2` command:\n\n`madonctl -i mastodon.social oauth2 \u003e madonctl.yaml`\n\nFor details on the configuration, please check the [configuration](configuration.md) page.\n\n### Usage\n\nThe complete list of commands is available in the online help (`madonctl help`,\n`madonctl command --help`...) or in the\n[manpages](https://lilotux.net/~mikael/pub/madonctl/manual/html/).\n\n### Examples\n\nThis is a non-exhaustive list of commands, showing how madonctl works.\n\nTo post a simple \"toot\":\n``` sh\n% madonctl toot \"Hello, World\"\n```\n\nYou can change the toot visibility, add a Content Warning (a.k.a. spoiler)\nor send a media file:\n``` sh\n% madonctl toot --visibility direct \"@McKael Hello, you\"\n% madonctl toot --visibility private --spoiler CW \"The answer was 42\"\n% madonctl post --file image.jpg Selfie # Send a media file\n```\nNote: The default toot visibility can be set in the configuration file with\nthe `default_visibility` setting or with the environment variable (example\n`export MADONCTL_DEFAULT_VISIBILITY=unlisted`).\n\nSend (text) file content as new message:\n```\n% madonctl toot --text-file message.txt\n```\n\n... or read message from standard input:\n```\n% echo \"Hello from #madonctl\" | madonctl toot --stdin\n```\n\nReply to a message:\n``` sh\n% madonctl toot --in-reply-to 1234 --visibility direct \"@user1 @user2 response\"\n% madonctl toot --in-reply-to 1234 --add-mentions \"response\"\n```\nThe flag `--add-mentions` automatically adds mentions based on the toot you're\nreplying to.\n\nSome **account-related commands**:\n``` sh\n% madonctl accounts blocked                       # List blocked accounts\n% madonctl accounts muted                         # List muted accounts\n\n% madonctl account notifications --list --all    # List really all notifications\n% madonctl account notifications --list --clear  # List and clear notifications\n% madonctl account notifications --notification-id 1234 # Display notification\n% madonctl account notifications --dismiss --notification-id 1234\n```\n\nNote: By default, madonctl will send a single query.  If you want all available\nresults you should use the `--all` flag.  If you use a `--limit` value,\nmadonctl might send several queries until the number of results reaches this\nvalue.\n\n**Update** your account information:\n``` sh\n% madonctl account update --display-name \"John\"  # Update display name\n% madonctl account update --note \"Newcomer\"      # Update user note (bio)\n% madonctl account update --note \"\"              # Clear note\n% madonctl account update --avatar me.png        # Update avatar\n\n% madonctl account update --bot               # Advertise account as automated\n% madonctl account update --default-sensitive # Set medias sensitive by default\n% madonctl account update --default-language fra    # Set default toot language\n% madonctl account update --default-privacy private # Set default toot privacy\n```\n\nSee your own **posts**:\n``` sh\n% madonctl account statuses                      # See last posts\n% madonctl account statuses --all                # See all statuses\n```\n\nDisplay accounts you're **following** or your **followers**:\n``` sh\n% madonctl accounts following                     # See last following\n% madonctl accounts following --all               # See all followed accounts\n% madonctl accounts followers --limit 30          # Last 30 followers\n```\n\nAdd/remove a **favourite**, **boost** a status...\n``` sh\n% madonctl status --status-id 416671 favourite    # Fave a status\n% madonctl status --status-id 416671 boost        # Boost (reblog) a status\n\n% madonctl status --status-id 416671 unboost       # Cancel a boost\n```\n\n**Pin/unpin** a status...\n``` sh\n% madonctl status --status-id 533769 pin          # Pin a status\n% madonctl status --status-id 533769 unpin        # Unpin a status\n```\n\n**Pin/unpin** an account (i.e., account endorsement)...\n``` sh\n% madonctl status --account-id 1234 pin           # Pin (endorse) an account\n% madonctl status --account-id 1234 unpin         # Unpin an account\n\n% madonctl status pin @Gargron@mastodon.social\n```\n\nSearch for an account (only accounts known to your instance):\n``` sh\n% madonctl accounts search gargron\n```\n\n**Follow** an account with known ID:\n``` sh\n% madonctl account follow --account-id 1234\n```\n\nFollow a remote account:\n``` sh\n% madonctl account follow --remote Gargron@mastodon.social\n```\n\nmadonctl 2.3.0+ is able to recognize the kind of argument to specify and to\nuse the relevant API calls, so the previous commands could be written as:\n``` sh\n% madonctl account follow 1234\n% madonctl account follow Gargron@mastodon.social\n% madonctl account follow https://mastodon.social/@Gargron\n```\n\nNote: If you know the numeric account ID, you should use it to save extra API\ncalls.\n\n**Search** for accounts, statuses or hashtags:\n``` sh\n% madonctl search gargron\n% madonctl search mastodon\n```\n\nWhen the account ID is unknown, --user-id can be useful.\\\nYou can specify the (instance-specific) account ID number (--account-id) or\nthe user ID (--user-id).  In the later case, madonctl will search for the\nuser so it must match exactly the ID known to your instance (without the\n@domain suffix if the user is on the same instance).  The --user-id flag can\nalso contain an HTTP account URL.\n``` sh\n% madonctl account --user-id Gargron@mastodon.social -l5 statuses # Last 5 statuses\n% madonctl account --user-id https://mastodon.social/@Gargron -l5 statuses # Same\n```\n\nWith madonctl 2.3.0+, you can use the shorter forms:\n``` sh\n% madonctl account statuses -l5 Gargron@mastodon.social\n% madonctl account statuses -l5 https://mastodon.social/@Gargron\n% madonctl account statuses -l5 1   # (account ID)\n```\n\nPlease note that the form \"Gargron@mastodon.social\" will only work if this\naccount is known by the instance.  If it is unknown, the https link should work\n(and the Mastodon server will learn about the account).\n\nRead **timelines**:\n``` sh\n% madonctl timeline                 # Display home timeline\n% madonctl timeline home            # (same as previous command)\n% madonctl timeline public          # Display federated timeline\n% madonctl timeline public --local  # Display public local timeline\n% madonctl timeline direct          # Display timeline of direct messages\n\n% madonctl timeline --limit 3       # Display 3 latest home timeline messages\n```\n\nUse the **streaming API** and fetch timelines and notifications:\n``` sh\n% madonctl stream                   # Stream home timeline and notifications\n% madonctl stream local             # Stream local timeline\n% madonctl stream public            # Stream federated timeline\n% madonctl stream direct            # Stream direct messages\n```\n\nYou can also use **hashtag streams**:\n``` sh\n% madonctl stream :mastodon         # Stream for hastag 'mastodon'\n% madonctl stream :madonctl,golang  # Stream for several hashtags\n```\n\nPlease note that madonctl will use one socket per stream, so the number of\nconcurrent hashtags is currently limited to 4 for \"politeness\".\n\nIt is also possible to send every stream event (notification or status) to\nan **external command**.  You can can even combine it with a customized theme.\nThe contents will be sent to the standard input of this command:\n``` sh\nmadonctl stream --command gateway.sh --theme gateway\n```\n\n(Almost) All commands have a **customizable output**:\n``` sh\n% madonctl account show            # Display an account\n% madonctl account show -o yaml    # Display an account, in yaml\n% madonctl account show -o json    # Display an account, in json\n% madonctl stream local -o json     # Stream local timeline and output to JSON\n```\n\nYou can also use Go (Golang) **templates**:\n``` sh\n% madonctl account --account-id 1 followers --template '{{.acct}}{{\"\\n\"}}'\n```\n\nYou can write and use [themes](templates) as well:\n```\nmadonctl --theme=ansi timeline\n```\n\nThere are many more commands, you can find them in the online help or the manpage.\n\n\n### Shell completion\n\nIf you want **shell completion**, you can generate scripts with the following command: \\\n`madonctl completion bash` (or zsh)\n\nThen, just source the script in your shell.\n\nFor example, I have this line in my .zshrc:\n\n`source \u003c(madonctl completion zsh)`\n\n### Commands output\n\nThe output can be set to **json**, **yaml** or to a **Go template** for all commands.\\\nIf you are familiar with Kubernetes' kubectl, it is very similar.\n\nFor example, you can display your user token with:\\\n`madonctl config whoami --template '{{.access_token}}'`\\\nor the application ID with:\\\n`madonctl config dump --template '{{.ID}}'`\n\nAll the users that have favorited a given status:\\\n`madonctl status --status-id 101194 favourited-by --template '{{.username}}{{\"\\n\"}}'`\n\nSets of templates can be grouped as **themes**.\n\nFor more complex templates, one can use the `--template-file` option.\\\nSee the [themes \u0026 templates](templates) folder.\n\n## References\n\n- [madonctl manpages](https://lilotux.net/~mikael/pub/madonctl/manual/html/)\n- [madon](https://github.com/McKael/madon), the Go library for Mastodon API\n- [Mastodon API documentation](https://github.com/tootsuite/documentation/blob/master/Using-the-API/API.md)\n- [Mastodon repository](https://github.com/tootsuite/mastodon)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMcKael%2Fmadonctl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FMcKael%2Fmadonctl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMcKael%2Fmadonctl/lists"}