16 releases (breaking)
new 0.20.4 | Jan 17, 2025 |
---|---|
0.19.1 | Jan 12, 2025 |
0.15.1 | Dec 20, 2024 |
0.12.0 | Nov 30, 2024 |
#631 in Command line utilities
873 downloads per month
35KB
551 lines
Musket
With Musket a “shooter” “fires” a URL at a “target” :D.
Musket is a command line interface to send a URL to several destinations. Each destination handle the URL depending the nature of the destination, for example, Bluesky, Mastodon and LinkedIn destinations post the URL in the user's feed whereas Turso destination stores the URL in Turso Service (a SQLite database SaaS).
Usage
1.- Install
For a while, Musket is provided as a cargo package, therefore you need cargo installed in your machine.
cargo install musket
2.- Create the configuration file
To create the configuration file, execute:
$ musket init
Musket uses a configuration file named config.toml
. This file is placed in the directory musket
inside the users's home. This home depends of the operating system:
The
musket init
command will display the full path to the configuration file.
3.- Configure the destinations
All destinations have to be configured from the configuration file. The configuration is a .toml file, therefore, strings must be in quotes and booleans must be the word true or false.
Bluesky
Before sending a URL to Bluesky destination you must:
- Create a Bluesky account. For a while, Musket only suports the Bluesky Social provider.
- Fill the
bluesky
section in the Musket configuration file. You must provide:- the
identifier
is the account's username or email. - the
password
of the account. commentary
is the default text that will be shown in the post along the link.enabled
to set whether the destination can be selected.
- the
Mastodon
Before sending a URL to Mastodon destination you must:
- Create a Mastodon account.
- Create a Mastodon Application with the Write and Profile scopes added. Once the Application has been created an access token will be generated.
- Fill the
mastodon
section in the Musket configuration file. You must provide:- the
server
is the URL of your Mastodon account provider, for example: https://mastodon.online. - the
token
used as a authentication. commentary
is the default text that will be shown in the post along the link.enabled
to set whether the destination can be selected.
- the
Before sending a URL to LinkedIn destination you must:
- Create a LinkedIn Application with the Share on LinkedIn and Sign In with LinkedIn using OpenID Connect products added to the application.
- Create an access token with the email, openid, profile, w_member_social permissions.
- Get the author identifier (doing a request to the userinfo endpoint using the access token).
- Fill the
linkedin
section in the Musket configuration file. You must provide:- the
token
used as a bearer authentication. - the
author
identifier. commentary
is the default text that will be shown in the post along the link.visibility
, can be "PUBLIC" or "CONNECTIONS".enabled
to set whether the destination can be selected.
- the
Turso
Before sending a URL to Turso destination you must:
- Create a Turso account.
- Create a Turso Database.
- Create a Table with the following schema:
CREATE TABLE links (
id INTEGER PRIMARY KEY AUTOINCREMENT,
url TEXT,
tags TEXT,
created DATETIME
);
- Fill the
turso
section in the Musket configuration file. You must provide:- the url of the
database
where store the data. - the
token
used as a authentication. enabled
to set whether the destination can be selected.
- the url of the
4.- Using de CLI
Run musket -h
to get the details of each command and option.
Init command
Use this command to initialize Musket creating the configuration file:
$ musket init
The init command have one options:
- -f, --force: Use this option to create the configuration file by overwriting the existing one.
Fire command
Use this command to send a URL:
$ musket fire
The fire command have several options:
- -u, --url: Use this option to set the URL to send to the destinations. Url is mandatory.
- -d, --destination: Use this option to set where the URL will be send. At least, one destination must be specified.
- -t, --tags: Use this option to set the tags to be used in the destinations. Tags are optional.
- -c, --commentary: Use this option to set the text that will be published along with the URL. Commentary is optional. If no text is specified, then the text set in the configuration file will be used. Turso destination not uses commentaries.
$ musket fire --url <URL> --destination <DESTINATION> --tags <tags> --commentary <text>
For example:
$ musket fire --url wikipedia.org --destination bluesky,mastodon,linked-in,turso --tags one,two,three --commentary "I've just discover this amazing website!"
or
$ musket fire --url wikipedia.org -d bluesky -d mastodon -d linked-in -d turso -t one -t two -t three -c "I've just discover this amazing website!"
Contributing
If you want to contribute to Musket, please read the CONTRIBUTING.md document.
Dependencies
~17–35MB
~500K SLoC