Musket
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, Turso destination stores the URL in Turso Service (a SQLite database SaaS) and LinkedIn destination publish the link in the user profile.
Usage
Installation
From Cargo
Requirements
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
linkedinsection in the Musket configuration file. You must provide:
- the
tokenused as a bearer authentication. - the
authoridentifier. share_commentaryis the text that will be shown in the post along the link.visibility, can be "PUBLIC" or "CONNECTIONS".
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:
(
id INTEGER PRIMARY KEY AUTOINCREMENT,
url TEXT,
tags TEXT,
created DATETIME
);
- Fill the
tursosection in the Musket configuration file. You must provide the databaseurland the tursotoken.
Configuration file
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:
If the configuration file doesn't exists it will be created (empty) when Musket is executed. You can update the file manually to configure Musket to your needs.
Execute
For example:
or
Run musket -h to get the details of each subcommand and arguments.
Contributing
Requirements
Last stable Rust toolchain. Use Rustup to install it.
Guidelines
- Use Conventional Commits.
- Use Feature Branch creating a pull request to main.
- Use Semantic Versioning.
Destinations
To add new destinations you must follow the next steps:
Info: Use the Turso destination files to see the code of the following steps.
1. Define the configuration
Add a struct to define the destination configuration to be placed in the configuration file.
Add a field in the Configuration struct with the destination as a name and the destination configuration as a type:
2. Create a module
Create a file with the name of the new destination inside destinations folder.
This file must:
- have a
structwith the fields needed to configure the destination. This fields must bepub. - implement
Destinationtrait.
Once created, add the new module as a public module in the destination module inside the mod.rs file.
3. Manage new destination from the CLI
Add the new destination as a variant of the enum Destinations inside the cli.rs file.
4. Create a Command
Create a file with the name of the new destination inside commands folder.
This file must implement a function named execute in charge of perform the sending of the URL (and tags if needed) to the destination.
Once created, add the new module as a public module in the commands module inside the mod.rs file.
5. Manage new destination from the main
Add the new destination as a pattern matching of the Fire command, and add a call to the command created above.
Turso =>