Skip to content

Commit

Permalink
added option to set client name on cli clients
Browse files Browse the repository at this point in the history
  • Loading branch information
babymotte committed Jul 15, 2024
1 parent d08f106 commit ceef9fb
Show file tree
Hide file tree
Showing 12 changed files with 72 additions and 0 deletions.
6 changes: 6 additions & 0 deletions worterbuch-cli/src/bin/wbdel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ struct Args {
/// Print only the value of the deleted key/value pair
#[arg(short, long)]
raw: bool,
/// Set a client name on the server
#[arg(short, long)]
name: Option<String>,
}

#[tokio::main(flavor = "current_thread")]
Expand Down Expand Up @@ -86,6 +89,9 @@ async fn wbdel(subsys: SubsystemHandle) -> Result<()> {
};

let wb = connect(config, on_disconnect).await?;
if let Some(name) = args.name {
wb.set_client_name(name).await?;
}
let mut responses = wb.all_messages().await?;

let mut trans_id = 0;
Expand Down
6 changes: 6 additions & 0 deletions worterbuch-cli/src/bin/wbget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ struct Args {
/// Print only the value of the specified key
#[arg(short, long)]
raw: bool,
/// Set a client name on the server
#[arg(short, long)]
name: Option<String>,
}

#[tokio::main(flavor = "current_thread")]
Expand Down Expand Up @@ -89,6 +92,9 @@ async fn run(subsys: SubsystemHandle) -> Result<()> {
};

let wb = connect(config, on_disconnect).await?;
if let Some(name) = args.name {
wb.set_client_name(name).await?;
}
let mut responses = wb.all_messages().await?;

let mut trans_id = 0;
Expand Down
6 changes: 6 additions & 0 deletions worterbuch-cli/src/bin/wbls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ struct Args {
/// Auth token to be used for acquiring authorization from the server
#[arg(long)]
auth: Option<AuthToken>,
/// Set a client name on the server
#[arg(short, long)]
name: Option<String>,
}

#[tokio::main(flavor = "current_thread")]
Expand Down Expand Up @@ -85,6 +88,9 @@ async fn run(subsys: SubsystemHandle) -> Result<()> {
};

let wb = connect(config, on_disconnect).await?;
if let Some(name) = args.name {
wb.set_client_name(name).await?;
}
let mut responses = wb.all_messages().await?;

let trans_id = wb.ls_async(parent).await?;
Expand Down
6 changes: 6 additions & 0 deletions worterbuch-cli/src/bin/wblssub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ struct Args {
/// Auth token to be used for acquiring authorization from the server
#[arg(long)]
auth: Option<AuthToken>,
/// Set a client name on the server
#[arg(short, long)]
name: Option<String>,
}

#[tokio::main(flavor = "current_thread")]
Expand Down Expand Up @@ -85,6 +88,9 @@ async fn run(subsys: SubsystemHandle) -> Result<()> {
};

let wb = connect(config, on_disconnect).await?;
if let Some(name) = args.name {
wb.set_client_name(name).await?;
}
let mut responses = wb.all_messages().await?;

let mut rx = provide_keys(paths, subsys.clone());
Expand Down
6 changes: 6 additions & 0 deletions worterbuch-cli/src/bin/wbpdel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ struct Args {
/// Print only the deleted key/value pairs
#[arg(short, long)]
raw: bool,
/// Set a client name on the server
#[arg(short, long)]
name: Option<String>,
}
#[tokio::main(flavor = "current_thread")]
async fn main() -> Result<()> {
Expand Down Expand Up @@ -88,6 +91,9 @@ async fn run(subsys: SubsystemHandle) -> Result<()> {
};

let wb = connect(config, on_disconnect).await?;
if let Some(name) = args.name {
wb.set_client_name(name).await?;
}
let mut responses = wb.all_messages().await?;

let mut trans_id = 0;
Expand Down
6 changes: 6 additions & 0 deletions worterbuch-cli/src/bin/wbpget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ struct Args {
/// Print only the received key/value pairs
#[arg(short, long)]
raw: bool,
/// Set a client name on the server
#[arg(short, long)]
name: Option<String>,
}

#[tokio::main(flavor = "current_thread")]
Expand Down Expand Up @@ -89,6 +92,9 @@ async fn run(subsys: SubsystemHandle) -> Result<()> {
};

let wb = connect(config, on_disconnect).await?;
if let Some(name) = args.name {
wb.set_client_name(name).await?;
}
let mut responses = wb.all_messages().await?;

let mut trans_id = 0;
Expand Down
6 changes: 6 additions & 0 deletions worterbuch-cli/src/bin/wbpsub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ struct Args {
/// Print only the received events
#[arg(short, long)]
raw: bool,
/// Set a client name on the server
#[arg(short, long)]
name: Option<String>,
}

#[tokio::main(flavor = "current_thread")]
Expand Down Expand Up @@ -97,6 +100,9 @@ async fn run(subsys: SubsystemHandle) -> Result<()> {
};

let wb = connect(config, on_disconnect).await?;
if let Some(name) = args.name {
wb.set_client_name(name).await?;
}
let mut responses = wb.all_messages().await?;

let mut rx = provide_keys(patterns, subsys.clone());
Expand Down
6 changes: 6 additions & 0 deletions worterbuch-cli/src/bin/wbpub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ struct Args {
/// Auth token to be used for acquiring authorization from the server
#[arg(long)]
auth: Option<AuthToken>,
/// Set a client name on the server
#[arg(short, long)]
name: Option<String>,
}

#[tokio::main(flavor = "current_thread")]
Expand Down Expand Up @@ -85,6 +88,9 @@ async fn run(subsys: SubsystemHandle) -> Result<()> {
};

let wb = connect(config, on_disconnect).await?;
if let Some(name) = args.name {
wb.set_client_name(name).await?;
}
let mut responses = wb.all_messages().await?;

let mut trans_id = 0;
Expand Down
6 changes: 6 additions & 0 deletions worterbuch-cli/src/bin/wbpubs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ struct Args {
/// Auth token to be used for acquiring authorization from the server
#[arg(long)]
auth: Option<AuthToken>,
/// Set a client name on the server
#[arg(short, long)]
name: Option<String>,
}

#[tokio::main(flavor = "current_thread")]
Expand Down Expand Up @@ -85,6 +88,9 @@ async fn run(subsys: SubsystemHandle) -> Result<()> {
};

let wb = connect(config, on_disconnect).await?;
if let Some(name) = args.name {
wb.set_client_name(name).await?;
}
let mut responses = wb.all_messages().await?;

let mut trans_id = 0;
Expand Down
6 changes: 6 additions & 0 deletions worterbuch-cli/src/bin/wbset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ struct Args {
/// Auth token to be used for acquiring authorization from the server
#[arg(long)]
auth: Option<AuthToken>,
/// Set a client name on the server
#[arg(short, long)]
name: Option<String>,
}

#[tokio::main(flavor = "current_thread")]
Expand Down Expand Up @@ -85,6 +88,9 @@ async fn run(subsys: SubsystemHandle) -> Result<()> {
};

let wb = connect(config, on_disconnect).await?;
if let Some(name) = args.name {
wb.set_client_name(name).await?;
}
let mut responses = wb.all_messages().await?;

let mut trans_id = 0;
Expand Down
6 changes: 6 additions & 0 deletions worterbuch-cli/src/bin/wbsets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ struct Args {
/// Auth token to be used for acquiring authorization from the server
#[arg(long)]
auth: Option<AuthToken>,
/// Set a client name on the server
#[arg(short, long)]
name: Option<String>,
}

#[tokio::main(flavor = "current_thread")]
Expand Down Expand Up @@ -85,6 +88,9 @@ async fn run(subsys: SubsystemHandle) -> Result<()> {
};

let wb = connect(config, on_disconnect).await?;
if let Some(name) = args.name {
wb.set_client_name(name).await?;
}
let mut responses = wb.all_messages().await?;

let mut trans_id = 0;
Expand Down
6 changes: 6 additions & 0 deletions worterbuch-cli/src/bin/wbsub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ struct Args {
/// Print only the received events
#[arg(short, long)]
raw: bool,
/// Set a client name on the server
#[arg(short, long)]
name: Option<String>,
}

#[tokio::main(flavor = "current_thread")]
Expand Down Expand Up @@ -97,6 +100,9 @@ async fn run(subsys: SubsystemHandle) -> Result<()> {
};

let wb = connect(config, on_disconnect).await?;
if let Some(name) = args.name {
wb.set_client_name(name).await?;
}
let mut responses = wb.all_messages().await?;

let mut rx = provide_keys(keys, subsys.clone());
Expand Down

0 comments on commit ceef9fb

Please sign in to comment.