refactor(subscriptions): ensure consistent naming

This commit renames add-subscriber and remove-subscriber to subscribe
and unsubscribe for more semantic consistency in command names, as well
as improving and fixing the cli documentation for these commands.

@denBot's example of how to create named pipes and subscribe to events
has also been added to the readme.
This commit is contained in:
LGUG2Z
2021-10-25 12:08:13 -07:00
parent 6ae59671a2
commit 6c53fd7830
3 changed files with 24 additions and 19 deletions

View File

@@ -315,14 +315,14 @@ struct LoadCustomLayout {
}
#[derive(Clap, AhkFunction)]
struct AddSubscriber {
/// Name of the pipe to send notifications to (without "\\.\pipe\" prepended)
struct Subscribe {
/// Name of the pipe to send event notifications to (without "\\.\pipe\" prepended)
named_pipe: String,
}
#[derive(Clap, AhkFunction)]
struct RemoveSubscriber {
/// Name of the pipe to stop sending notifications to (without "\\.\pipe\" prepended)
struct Unsubscribe {
/// Name of the pipe to stop sending event notifications to (without "\\.\pipe\" prepended)
named_pipe: String,
}
@@ -344,12 +344,12 @@ enum SubCommand {
/// Query the current window manager state
#[clap(setting = AppSettings::ArgRequiredElseHelp)]
Query(Query),
/// Subscribe to all komorebi events on a named pipe
/// Subscribe to komorebi events
#[clap(setting = AppSettings::ArgRequiredElseHelp)]
AddSubscriber(AddSubscriber),
/// Subscribe to all komorebi events on a named pipe
Subscribe(Subscribe),
/// Unsubscribe from komorebi events
#[clap(setting = AppSettings::ArgRequiredElseHelp)]
RemoveSubscriber(RemoveSubscriber),
Unsubscribe(Unsubscribe),
/// Tail komorebi.exe's process logs (cancel with Ctrl-C)
Log,
/// Quicksave the current resize layout dimensions
@@ -913,10 +913,10 @@ fn main() -> Result<()> {
SubCommand::Load(arg) => {
send_message(&*SocketMessage::Load(resolve_windows_path(&arg.path)?).as_bytes()?)?;
}
SubCommand::AddSubscriber(arg) => {
SubCommand::Subscribe(arg) => {
send_message(&*SocketMessage::AddSubscriber(arg.named_pipe).as_bytes()?)?;
}
SubCommand::RemoveSubscriber(arg) => {
SubCommand::Unsubscribe(arg) => {
send_message(&*SocketMessage::RemoveSubscriber(arg.named_pipe).as_bytes()?)?;
}
}